| 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 ArrayVar; |
| 18 class DictionaryVar; | 19 class DictionaryVar; |
| 19 class NPObjectVar; | 20 class NPObjectVar; |
| 20 class ProxyObjectVar; | 21 class ProxyObjectVar; |
| 21 class StringVar; | 22 class StringVar; |
| 22 class VarTracker; | 23 class VarTracker; |
| 23 | 24 |
| 24 // Var ------------------------------------------------------------------------- | 25 // Var ------------------------------------------------------------------------- |
| 25 | 26 |
| 26 // Represents a non-POD var. | 27 // Represents a non-POD var. |
| 27 class PPAPI_SHARED_EXPORT Var : public base::RefCounted<Var> { | 28 class PPAPI_SHARED_EXPORT Var : public base::RefCounted<Var> { |
| 28 public: | 29 public: |
| 29 virtual ~Var(); | 30 virtual ~Var(); |
| 30 | 31 |
| 31 // Returns a string representing the given var for logging purposes. | 32 // Returns a string representing the given var for logging purposes. |
| 32 static std::string PPVarToLogString(PP_Var var); | 33 static std::string PPVarToLogString(PP_Var var); |
| 33 | 34 |
| 34 virtual StringVar* AsStringVar(); | 35 virtual StringVar* AsStringVar(); |
| 35 virtual ArrayBufferVar* AsArrayBufferVar(); | 36 virtual ArrayBufferVar* AsArrayBufferVar(); |
| 36 virtual NPObjectVar* AsNPObjectVar(); | 37 virtual NPObjectVar* AsNPObjectVar(); |
| 37 virtual ProxyObjectVar* AsProxyObjectVar(); | 38 virtual ProxyObjectVar* AsProxyObjectVar(); |
| 39 virtual ArrayVar* AsArrayVar(); |
| 38 virtual DictionaryVar* AsDictionaryVar(); | 40 virtual DictionaryVar* AsDictionaryVar(); |
| 39 | 41 |
| 40 // Creates a PP_Var corresponding to this object. The return value will have | 42 // Creates a PP_Var corresponding to this object. The return value will have |
| 41 // one reference addrefed on behalf of the caller. | 43 // one reference addrefed on behalf of the caller. |
| 42 PP_Var GetPPVar(); | 44 PP_Var GetPPVar(); |
| 43 | 45 |
| 44 // Returns the type of this var. | 46 // Returns the type of this var. |
| 45 virtual PP_VarType GetType() const = 0; | 47 virtual PP_VarType GetType() const = 0; |
| 46 | 48 |
| 47 // Returns the ID corresponing to the string or object if it exists already, | 49 // Returns the ID corresponing to the string or object if it exists already, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // return NULL if the PP_Var is not of ArrayBuffer type. | 168 // return NULL if the PP_Var is not of ArrayBuffer type. |
| 167 static ArrayBufferVar* FromPPVar(PP_Var var); | 169 static ArrayBufferVar* FromPPVar(PP_Var var); |
| 168 | 170 |
| 169 private: | 171 private: |
| 170 DISALLOW_COPY_AND_ASSIGN(ArrayBufferVar); | 172 DISALLOW_COPY_AND_ASSIGN(ArrayBufferVar); |
| 171 }; | 173 }; |
| 172 | 174 |
| 173 } // namespace ppapi | 175 } // namespace ppapi |
| 174 | 176 |
| 175 #endif // PPAPI_SHARED_IMPL_VAR_H_ | 177 #endif // PPAPI_SHARED_IMPL_VAR_H_ |
| OLD | NEW |