| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_CPP_VAR_H_ | 5 #ifndef PPAPI_CPP_VAR_H_ |
| 6 #define PPAPI_CPP_VAR_H_ | 6 #define PPAPI_CPP_VAR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ppapi/c/pp_module.h" |
| 11 #include "ppapi/c/pp_var.h" | 12 #include "ppapi/c/pp_var.h" |
| 12 | 13 |
| 13 namespace pp { | 14 namespace pp { |
| 14 | 15 |
| 16 class Instance; |
| 17 |
| 15 namespace deprecated { | 18 namespace deprecated { |
| 16 class ScriptableObject; | 19 class ScriptableObject; |
| 17 } | 20 } |
| 18 | 21 |
| 19 class Var { | 22 class Var { |
| 20 public: | 23 public: |
| 21 struct Null {}; // Special value passed to constructor to make NULL. | 24 struct Null {}; // Special value passed to constructor to make NULL. |
| 22 | 25 |
| 23 Var(); // PP_Var of type Undefined. | 26 Var(); // PP_Var of type Undefined. |
| 24 Var(Null); // PP_Var of type Null. | 27 Var(Null); // PP_Var of type Null. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 42 // argument from somewhere and that reference is managing the reference | 45 // argument from somewhere and that reference is managing the reference |
| 43 // count for us. The object will not be AddRef'ed or Release'd by this | 46 // count for us. The object will not be AddRef'ed or Release'd by this |
| 44 // class instance.. | 47 // class instance.. |
| 45 struct DontManage {}; | 48 struct DontManage {}; |
| 46 Var(DontManage, PP_Var var) { | 49 Var(DontManage, PP_Var var) { |
| 47 var_ = var; | 50 var_ = var; |
| 48 needs_release_ = false; | 51 needs_release_ = false; |
| 49 } | 52 } |
| 50 | 53 |
| 51 // Takes ownership of the given pointer. | 54 // Takes ownership of the given pointer. |
| 52 Var(deprecated::ScriptableObject* object); | 55 Var(Instance* instance, deprecated::ScriptableObject* object); |
| 53 | 56 |
| 54 Var(const Var& other); | 57 Var(const Var& other); |
| 55 | 58 |
| 56 virtual ~Var(); | 59 virtual ~Var(); |
| 57 | 60 |
| 58 Var& operator=(const Var& other); | 61 Var& operator=(const Var& other); |
| 59 | 62 |
| 60 bool operator==(const Var& other) const; | 63 bool operator==(const Var& other) const; |
| 61 | 64 |
| 62 bool is_undefined() const { return var_.type == PP_VARTYPE_UNDEFINED; } | 65 bool is_undefined() const { return var_.type == PP_VARTYPE_UNDEFINED; } |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // get a compilation error. | 199 // get a compilation error. |
| 197 Var(void* non_scriptable_object_pointer); | 200 Var(void* non_scriptable_object_pointer); |
| 198 | 201 |
| 199 PP_Var var_; | 202 PP_Var var_; |
| 200 bool needs_release_; | 203 bool needs_release_; |
| 201 }; | 204 }; |
| 202 | 205 |
| 203 } // namespace pp | 206 } // namespace pp |
| 204 | 207 |
| 205 #endif // PPAPI_CPP_VAR_H_ | 208 #endif // PPAPI_CPP_VAR_H_ |
| OLD | NEW |