Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: ppapi/native_client/src/shared/ppapi_proxy/proxy_var.h

Issue 7740013: Cloning a bunch of stuff from the native_client repository at r6528 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PROXY_VAR_H_
6 #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PROXY_VAR_H_
7
8 #include "native_client/src/include/nacl_macros.h"
9 #include "native_client/src/include/nacl_memory.h"
10 #include "native_client/src/include/ref_counted.h"
11 #include "ppapi/c/pp_var.h"
12
13 namespace ppapi_proxy {
14
15 // Complex PP_Var types (such as strings) have a copy of the variant's contents
16 // cached by the proxy. This is done so that PP_Vars can be reference counted,
17 // and their contents accessed "locally" by NaCl modules without having to
18 // perform a complete round trip to the browser for each such operation.
19 //
20 // Note: this class is intended to be sub-classed to handle specific content
21 // types such as strings, dictionaries, or arrays.
22 class ProxyVar : public nacl::RefCounted<ProxyVar> {
23 public:
24 // The type of this cached object. Simple types (int, bool, etc.) are not
25 // cached.
26 PP_VarType pp_var_type() const { return pp_var_type_; }
27
28 // The assigned unique id associated with this object. Use this as the id
29 // for the corresponding PP_Var.
30 int64_t id() const { return id_; }
31
32 protected:
33 // Initialize this instance to represent a PP_Var of type |pp_var_type|.
34 // Generates a unique id for this instance, and sets the reference count to 1.
35 // Subclasses should implement ctors that handle specific content data.
36 explicit ProxyVar(PP_VarType pp_var_type);
37
38 virtual ~ProxyVar() {}
39
40 private:
41 friend class nacl::RefCounted<ProxyVar>;
42 PP_VarType pp_var_type_;
43 int64_t id_;
44
45 ProxyVar(); // Not implemented - do not use.
46 NACL_DISALLOW_COPY_AND_ASSIGN(ProxyVar);
47
48 // A counter for unique ids.
49 static int64_t unique_var_id;
50 };
51
52 typedef scoped_refptr<ProxyVar> SharedProxyVar;
53
54 } // namespace ppapi_proxy
55
56 #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PROXY_VAR_H_
OLDNEW
« no previous file with comments | « ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h ('k') | ppapi/native_client/src/shared/ppapi_proxy/proxy_var.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698