OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PPAPI_PROXY_PROXY_OBJECT_VAR_H_ | 5 #ifndef PPAPI_PROXY_PROXY_OBJECT_VAR_H_ |
6 #define PPAPI_PROXY_PROXY_OBJECT_VAR_H_ | 6 #define PPAPI_PROXY_PROXY_OBJECT_VAR_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" |
9 #include "ppapi/proxy/ppapi_proxy_export.h" | 12 #include "ppapi/proxy/ppapi_proxy_export.h" |
10 #include "ppapi/shared_impl/var.h" | 13 #include "ppapi/shared_impl/var.h" |
11 | 14 |
12 namespace ppapi { | 15 namespace ppapi { |
13 | 16 |
14 namespace proxy { | 17 namespace proxy { |
15 class PluginDispatcher; | 18 class PluginDispatcher; |
16 } // namespace proxy | 19 } // namespace proxy |
17 | 20 |
18 // Tracks a reference to an object var in the plugin side of the proxy. This | 21 // Tracks a reference to an object var in the plugin side of the proxy. This |
19 // just stores the dispatcher and host var ID, and provides the interface for | 22 // just stores the dispatcher and host var ID, and provides the interface for |
20 // integrating this with PP_Var creation. | 23 // integrating this with PP_Var creation. |
21 class PPAPI_PROXY_EXPORT ProxyObjectVar : public Var { | 24 class PPAPI_PROXY_EXPORT ProxyObjectVar : public Var { |
22 public: | 25 public: |
23 ProxyObjectVar(proxy::PluginDispatcher* dispatcher, | 26 ProxyObjectVar(proxy::PluginDispatcher* dispatcher, int32_t host_var_id); |
24 int32 host_var_id); | |
25 | 27 |
26 ~ProxyObjectVar() override; | 28 ~ProxyObjectVar() override; |
27 | 29 |
28 // Var overrides. | 30 // Var overrides. |
29 ProxyObjectVar* AsProxyObjectVar() override; | 31 ProxyObjectVar* AsProxyObjectVar() override; |
30 PP_VarType GetType() const override; | 32 PP_VarType GetType() const override; |
31 | 33 |
32 proxy::PluginDispatcher* dispatcher() const { return dispatcher_; } | 34 proxy::PluginDispatcher* dispatcher() const { return dispatcher_; } |
33 int32 host_var_id() const { return host_var_id_; } | 35 int32_t host_var_id() const { return host_var_id_; } |
34 | 36 |
35 void* user_data() const { return user_data_; } | 37 void* user_data() const { return user_data_; } |
36 void set_user_data(void* ud) { user_data_ = ud; } | 38 void set_user_data(void* ud) { user_data_ = ud; } |
37 | 39 |
38 // Expose AssignVarID on Var so the PluginResourceTracker can call us when | 40 // Expose AssignVarID on Var so the PluginResourceTracker can call us when |
39 // it's creating IDs. | 41 // it's creating IDs. |
40 void AssignVarID(int32 id); | 42 void AssignVarID(int32_t id); |
41 | 43 |
42 void clear_dispatcher() { dispatcher_ = NULL; } | 44 void clear_dispatcher() { dispatcher_ = NULL; } |
43 | 45 |
44 private: | 46 private: |
45 proxy::PluginDispatcher* dispatcher_; | 47 proxy::PluginDispatcher* dispatcher_; |
46 int32 host_var_id_; | 48 int32_t host_var_id_; |
47 | 49 |
48 // When this object is created as representing a var implemented by the | 50 // When this object is created as representing a var implemented by the |
49 // plugin, this stores the user data so that we can look it up later. See | 51 // plugin, this stores the user data so that we can look it up later. See |
50 // PluginVarTracker. | 52 // PluginVarTracker. |
51 void* user_data_; | 53 void* user_data_; |
52 | 54 |
53 DISALLOW_COPY_AND_ASSIGN(ProxyObjectVar); | 55 DISALLOW_COPY_AND_ASSIGN(ProxyObjectVar); |
54 }; | 56 }; |
55 | 57 |
56 } // namespace ppapi | 58 } // namespace ppapi |
57 | 59 |
58 #endif // PPAPI_PROXY_PROXY_OBJECT_VAR_H_ | 60 #endif // PPAPI_PROXY_PROXY_OBJECT_VAR_H_ |
OLD | NEW |