OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SHARED_IMPL_VAR_H_ | 5 #ifndef PPAPI_SHARED_IMPL_VAR_H_ |
6 #define PPAPI_SHARED_IMPL_VAR_H_ | 6 #define PPAPI_SHARED_IMPL_VAR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "ppapi/c/pp_var.h" | 12 #include "ppapi/c/pp_var.h" |
13 #include "ppapi/shared_impl/ppapi_shared_export.h" | 13 #include "ppapi/shared_impl/ppapi_shared_export.h" |
14 | 14 |
15 namespace ppapi { | 15 namespace ppapi { |
16 | 16 |
17 class ArrayBufferVar; | 17 class ArrayBufferVar; |
| 18 class DictionaryVar; |
18 class NPObjectVar; | 19 class NPObjectVar; |
19 class ProxyObjectVar; | 20 class ProxyObjectVar; |
20 class StringVar; | 21 class StringVar; |
21 class VarTracker; | 22 class VarTracker; |
22 | 23 |
23 // Var ------------------------------------------------------------------------- | 24 // Var ------------------------------------------------------------------------- |
24 | 25 |
25 // Represents a non-POD var. | 26 // Represents a non-POD var. |
26 class PPAPI_SHARED_EXPORT Var : public base::RefCounted<Var> { | 27 class PPAPI_SHARED_EXPORT Var : public base::RefCounted<Var> { |
27 public: | 28 public: |
28 virtual ~Var(); | 29 virtual ~Var(); |
29 | 30 |
30 // Returns a string representing the given var for logging purposes. | 31 // Returns a string representing the given var for logging purposes. |
31 static std::string PPVarToLogString(PP_Var var); | 32 static std::string PPVarToLogString(PP_Var var); |
32 | 33 |
33 virtual StringVar* AsStringVar(); | 34 virtual StringVar* AsStringVar(); |
34 virtual ArrayBufferVar* AsArrayBufferVar(); | 35 virtual ArrayBufferVar* AsArrayBufferVar(); |
35 virtual NPObjectVar* AsNPObjectVar(); | 36 virtual NPObjectVar* AsNPObjectVar(); |
36 virtual ProxyObjectVar* AsProxyObjectVar(); | 37 virtual ProxyObjectVar* AsProxyObjectVar(); |
| 38 virtual DictionaryVar* AsDictionaryVar(); |
37 | 39 |
38 // Creates a PP_Var corresponding to this object. The return value will have | 40 // Creates a PP_Var corresponding to this object. The return value will have |
39 // one reference addrefed on behalf of the caller. | 41 // one reference addrefed on behalf of the caller. |
40 PP_Var GetPPVar(); | 42 PP_Var GetPPVar(); |
41 | 43 |
42 // Returns the type of this var. | 44 // Returns the type of this var. |
43 virtual PP_VarType GetType() const = 0; | 45 virtual PP_VarType GetType() const = 0; |
44 | 46 |
45 // Returns the ID corresponing to the string or object if it exists already, | 47 // Returns the ID corresponing to the string or object if it exists already, |
46 // or 0 if an ID hasn't been generated for this object (the plugin is holding | 48 // or 0 if an ID hasn't been generated for this object (the plugin is holding |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // return NULL if the PP_Var is not of ArrayBuffer type. | 166 // return NULL if the PP_Var is not of ArrayBuffer type. |
165 static ArrayBufferVar* FromPPVar(PP_Var var); | 167 static ArrayBufferVar* FromPPVar(PP_Var var); |
166 | 168 |
167 private: | 169 private: |
168 DISALLOW_COPY_AND_ASSIGN(ArrayBufferVar); | 170 DISALLOW_COPY_AND_ASSIGN(ArrayBufferVar); |
169 }; | 171 }; |
170 | 172 |
171 } // namespace ppapi | 173 } // namespace ppapi |
172 | 174 |
173 #endif // PPAPI_SHARED_IMPL_VAR_H_ | 175 #endif // PPAPI_SHARED_IMPL_VAR_H_ |
OLD | NEW |