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 "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
13 #include "ppapi/c/pp_var.h" | 13 #include "ppapi/c/pp_var.h" |
14 #include "ppapi/shared_impl/host_resource.h" | 14 #include "ppapi/shared_impl/host_resource.h" |
15 #include "ppapi/shared_impl/ppapi_shared_export.h" | 15 #include "ppapi/shared_impl/ppapi_shared_export.h" |
16 | 16 |
17 namespace ppapi { | 17 namespace ppapi { |
18 | 18 |
19 class ArrayBufferVar; | 19 class ArrayBufferVar; |
20 class ArrayVar; | 20 class ArrayVar; |
21 class DictionaryVar; | 21 class DictionaryVar; |
22 class NPObjectVar; | |
23 class ProxyObjectVar; | 22 class ProxyObjectVar; |
24 class ResourceVar; | 23 class ResourceVar; |
25 class StringVar; | 24 class StringVar; |
26 class V8ObjectVar; | 25 class V8ObjectVar; |
27 class VarTracker; | 26 class VarTracker; |
28 | 27 |
29 // Var ------------------------------------------------------------------------- | 28 // Var ------------------------------------------------------------------------- |
30 | 29 |
31 // Represents a non-POD var. | 30 // Represents a non-POD var. |
32 class PPAPI_SHARED_EXPORT Var : public base::RefCounted<Var> { | 31 class PPAPI_SHARED_EXPORT Var : public base::RefCounted<Var> { |
33 public: | 32 public: |
34 // Returns a string representing the given var for logging purposes. | 33 // Returns a string representing the given var for logging purposes. |
35 static std::string PPVarToLogString(PP_Var var); | 34 static std::string PPVarToLogString(PP_Var var); |
36 | 35 |
37 virtual StringVar* AsStringVar(); | 36 virtual StringVar* AsStringVar(); |
38 virtual ArrayBufferVar* AsArrayBufferVar(); | 37 virtual ArrayBufferVar* AsArrayBufferVar(); |
39 virtual NPObjectVar* AsNPObjectVar(); | |
40 virtual V8ObjectVar* AsV8ObjectVar(); | 38 virtual V8ObjectVar* AsV8ObjectVar(); |
41 virtual ProxyObjectVar* AsProxyObjectVar(); | 39 virtual ProxyObjectVar* AsProxyObjectVar(); |
42 virtual ArrayVar* AsArrayVar(); | 40 virtual ArrayVar* AsArrayVar(); |
43 virtual DictionaryVar* AsDictionaryVar(); | 41 virtual DictionaryVar* AsDictionaryVar(); |
44 virtual ResourceVar* AsResourceVar(); | 42 virtual ResourceVar* AsResourceVar(); |
45 | 43 |
46 // Creates a PP_Var corresponding to this object. The return value will have | 44 // Creates a PP_Var corresponding to this object. The return value will have |
47 // one reference addrefed on behalf of the caller. | 45 // one reference addrefed on behalf of the caller. |
48 PP_Var GetPPVar(); | 46 PP_Var GetPPVar(); |
49 | 47 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // return NULL if the PP_Var is not of ArrayBuffer type. | 183 // return NULL if the PP_Var is not of ArrayBuffer type. |
186 static ArrayBufferVar* FromPPVar(PP_Var var); | 184 static ArrayBufferVar* FromPPVar(PP_Var var); |
187 | 185 |
188 private: | 186 private: |
189 DISALLOW_COPY_AND_ASSIGN(ArrayBufferVar); | 187 DISALLOW_COPY_AND_ASSIGN(ArrayBufferVar); |
190 }; | 188 }; |
191 | 189 |
192 } // namespace ppapi | 190 } // namespace ppapi |
193 | 191 |
194 #endif // PPAPI_SHARED_IMPL_VAR_H_ | 192 #endif // PPAPI_SHARED_IMPL_VAR_H_ |
OLD | NEW |