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 |
(...skipping 36 matching lines...) Loading... |
47 // class instance.. | 47 // class instance.. |
48 struct DontManage {}; | 48 struct DontManage {}; |
49 Var(DontManage, PP_Var var) { | 49 Var(DontManage, PP_Var var) { |
50 var_ = var; | 50 var_ = var; |
51 needs_release_ = false; | 51 needs_release_ = false; |
52 } | 52 } |
53 | 53 |
54 // Takes ownership of the given pointer. | 54 // Takes ownership of the given pointer. |
55 Var(Instance* instance, deprecated::ScriptableObject* object); | 55 Var(Instance* instance, deprecated::ScriptableObject* object); |
56 | 56 |
57 // TODO(brettw) erase this! This is a temporary hack to keep the build | |
58 // going while we land the nacl side of this change. Calling this function | |
59 // will crash rather than break the compile. | |
60 Var(deprecated::ScriptableObject* /* object */) { | |
61 *(int*)0 = 3; | |
62 } | |
63 | |
64 Var(const Var& other); | 57 Var(const Var& other); |
65 | 58 |
66 virtual ~Var(); | 59 virtual ~Var(); |
67 | 60 |
68 Var& operator=(const Var& other); | 61 Var& operator=(const Var& other); |
69 | 62 |
70 bool operator==(const Var& other) const; | 63 bool operator==(const Var& other) const; |
71 | 64 |
72 bool is_undefined() const { return var_.type == PP_VARTYPE_UNDEFINED; } | 65 bool is_undefined() const { return var_.type == PP_VARTYPE_UNDEFINED; } |
73 bool is_null() const { return var_.type == PP_VARTYPE_NULL; } | 66 bool is_null() const { return var_.type == PP_VARTYPE_NULL; } |
(...skipping 132 matching lines...) Loading... |
206 // get a compilation error. | 199 // get a compilation error. |
207 Var(void* non_scriptable_object_pointer); | 200 Var(void* non_scriptable_object_pointer); |
208 | 201 |
209 PP_Var var_; | 202 PP_Var var_; |
210 bool needs_release_; | 203 bool needs_release_; |
211 }; | 204 }; |
212 | 205 |
213 } // namespace pp | 206 } // namespace pp |
214 | 207 |
215 #endif // PPAPI_CPP_VAR_H_ | 208 #endif // PPAPI_CPP_VAR_H_ |
OLD | NEW |