OLD | NEW |
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2011 The Native Client 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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PROXY_VAR_H_ | 5 #ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PROXY_VAR_H_ |
6 #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PROXY_VAR_H_ | 6 #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PROXY_VAR_H_ |
7 | 7 |
8 #include "native_client/src/include/nacl_macros.h" | 8 #include "native_client/src/include/nacl_macros.h" |
9 #include "native_client/src/include/nacl_memory.h" | 9 #include "native_client/src/include/nacl_memory.h" |
10 #include "native_client/src/third_party/ppapi/c/pp_var.h" | 10 #include "native_client/src/third_party/ppapi/c/pp_var.h" |
11 | 11 |
12 namespace ppapi_proxy { | 12 namespace ppapi_proxy { |
13 | 13 |
14 // Complex PP_Var types (such as strings and objects) have a copy of the | 14 // Complex PP_Var types (such as strings) have a copy of the variant's contents |
15 // variant's contents cached by the proxy. This is done so that PP_Vars can | 15 // cached by the proxy. This is done so that PP_Vars can be reference counted, |
16 // be reference counted, and their contents accessed "locally" by NaCl modules | 16 // and their contents accessed "locally" by NaCl modules without having to |
17 // without having to perform a complete round trip to the browser for each | 17 // perform a complete round trip to the browser for each such operation. |
18 // such operation. | |
19 // | 18 // |
20 // Note: this class is intended to be sub-classed to handle specific content | 19 // Note: this class is intended to be sub-classed to handle specific content |
21 // types such as strings, objects or arrays. | 20 // types such as strings, dictionaries, or arrays. |
22 class ProxyVar { | 21 class ProxyVar { |
23 public: | 22 public: |
24 virtual ~ProxyVar() {} | 23 virtual ~ProxyVar() {} |
25 | 24 |
26 // Add a reference to this object. | 25 // Add a reference to this object. |
27 void Retain(); | 26 void Retain(); |
28 | 27 |
29 // Return true when the internal reference count is 0. | 28 // Return true when the internal reference count is 0. |
30 bool Release(); | 29 bool Release(); |
31 | 30 |
(...skipping 22 matching lines...) Expand all Loading... |
54 ProxyVar(); // Not implemented - do not use. | 53 ProxyVar(); // Not implemented - do not use. |
55 NACL_DISALLOW_COPY_AND_ASSIGN(ProxyVar); | 54 NACL_DISALLOW_COPY_AND_ASSIGN(ProxyVar); |
56 }; | 55 }; |
57 | 56 |
58 typedef std::tr1::shared_ptr<ProxyVar> SharedProxyVar; | 57 typedef std::tr1::shared_ptr<ProxyVar> SharedProxyVar; |
59 | 58 |
60 } // namespace ppapi_proxy | 59 } // namespace ppapi_proxy |
61 | 60 |
62 #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PROXY_VAR_H_ | 61 #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PROXY_VAR_H_ |
63 | 62 |
OLD | NEW |