Avi Drissman | db497b3 | 2022-09-15 19:47:28 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors |
mgiuca@chromium.org | c82b014 | 2013-09-23 15:09:21 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef PPAPI_PROXY_PLUGIN_RESOURCE_VAR_H_ |
| 6 | #define PPAPI_PROXY_PLUGIN_RESOURCE_VAR_H_ |
| 7 | |
| 8 | #include "ppapi/c/pp_resource.h" |
| 9 | #include "ppapi/proxy/ppapi_proxy_export.h" |
| 10 | #include "ppapi/shared_impl/resource.h" |
| 11 | #include "ppapi/shared_impl/resource_var.h" |
| 12 | #include "ppapi/shared_impl/var.h" |
| 13 | |
| 14 | // Represents a resource Var, usable on the plugin side. |
| 15 | class PPAPI_PROXY_EXPORT PluginResourceVar : public ppapi::ResourceVar { |
| 16 | public: |
| 17 | // Makes a null resource var. |
| 18 | PluginResourceVar(); |
| 19 | |
| 20 | // Makes a resource var with an existing resource. |
| 21 | // Takes one reference to the given resource. |
| 22 | explicit PluginResourceVar(ppapi::Resource* resource); |
| 23 | |
Peter Boström | 896f137 | 2021-11-05 01:12:30 | [diff] [blame] | 24 | PluginResourceVar(const PluginResourceVar&) = delete; |
| 25 | PluginResourceVar& operator=(const PluginResourceVar&) = delete; |
| 26 | |
mgiuca@chromium.org | c82b014 | 2013-09-23 15:09:21 | [diff] [blame] | 27 | // ResourceVar override. |
nick | e478443 | 2015-04-23 14:01:48 | [diff] [blame] | 28 | PP_Resource GetPPResource() const override; |
| 29 | bool IsPending() const override; |
mgiuca@chromium.org | c82b014 | 2013-09-23 15:09:21 | [diff] [blame] | 30 | |
| 31 | scoped_refptr<ppapi::Resource> resource() const { return resource_; } |
| 32 | |
| 33 | protected: |
nick | e478443 | 2015-04-23 14:01:48 | [diff] [blame] | 34 | ~PluginResourceVar() override; |
mgiuca@chromium.org | c82b014 | 2013-09-23 15:09:21 | [diff] [blame] | 35 | |
| 36 | private: |
mgiuca@chromium.org | 5288f73 | 2013-10-16 02:05:34 | [diff] [blame] | 37 | // If NULL, this represents the PP_Resource 0. |
mgiuca@chromium.org | c82b014 | 2013-09-23 15:09:21 | [diff] [blame] | 38 | scoped_refptr<ppapi::Resource> resource_; |
mgiuca@chromium.org | c82b014 | 2013-09-23 15:09:21 | [diff] [blame] | 39 | }; |
| 40 | |
Sumaid Syed | 89da162 | 2021-07-29 06:41:22 | [diff] [blame] | 41 | #endif // PPAPI_PROXY_PLUGIN_RESOURCE_VAR_H_ |