| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 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   Var(const Var& other); | 57   Var(const Var& other); | 
| 58 | 58 | 
| 59   virtual ~Var(); | 59   virtual ~Var(); | 
| 60 | 60 | 
| 61   Var& operator=(const Var& other); | 61   Var& operator=(const Var& other); | 
| 62 | 62 | 
|  | 63   // For objects, dictionaries, and arrays, this operator compares object | 
|  | 64   // identity rather than value identity. | 
| 63   bool operator==(const Var& other) const; | 65   bool operator==(const Var& other) const; | 
| 64 | 66 | 
| 65   bool is_undefined() const { return var_.type == PP_VARTYPE_UNDEFINED; } | 67   bool is_undefined() const { return var_.type == PP_VARTYPE_UNDEFINED; } | 
| 66   bool is_null() const { return var_.type == PP_VARTYPE_NULL; } | 68   bool is_null() const { return var_.type == PP_VARTYPE_NULL; } | 
| 67   bool is_bool() const { return var_.type == PP_VARTYPE_BOOL; } | 69   bool is_bool() const { return var_.type == PP_VARTYPE_BOOL; } | 
| 68   bool is_string() const { return var_.type == PP_VARTYPE_STRING; } | 70   bool is_string() const { return var_.type == PP_VARTYPE_STRING; } | 
| 69   bool is_object() const { return var_.type == PP_VARTYPE_OBJECT; } | 71   bool is_object() const { return var_.type == PP_VARTYPE_OBJECT; } | 
| 70 | 72 | 
| 71   // IsInt and IsDouble return the internal representation. The JavaScript | 73   // IsInt and IsDouble return the internal representation. The JavaScript | 
| 72   // runtime may convert between the two as needed, so the distinction may | 74   // runtime may convert between the two as needed, so the distinction may | 
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 188         return &temp_; | 190         return &temp_; | 
| 189       return NULL; | 191       return NULL; | 
| 190     } | 192     } | 
| 191 | 193 | 
| 192    private: | 194    private: | 
| 193     Var* output_; | 195     Var* output_; | 
| 194     bool originally_had_exception_; | 196     bool originally_had_exception_; | 
| 195     PP_Var temp_; | 197     PP_Var temp_; | 
| 196   }; | 198   }; | 
| 197 | 199 | 
|  | 200  protected: | 
|  | 201   PP_Var var_; | 
|  | 202   bool needs_release_; | 
|  | 203 | 
| 198  private: | 204  private: | 
| 199   // Prevent an arbitrary pointer argument from being implicitly converted to | 205   // Prevent an arbitrary pointer argument from being implicitly converted to | 
| 200   // a bool at Var construction. If somebody makes such a mistake, (s)he will | 206   // a bool at Var construction. If somebody makes such a mistake, (s)he will | 
| 201   // get a compilation error. | 207   // get a compilation error. | 
| 202   Var(void* non_scriptable_object_pointer); | 208   Var(void* non_scriptable_object_pointer); | 
| 203 | 209 | 
| 204   PP_Var var_; |  | 
| 205   bool needs_release_; |  | 
| 206 }; | 210 }; | 
| 207 | 211 | 
| 208 }  // namespace pp | 212 }  // namespace pp | 
| 209 | 213 | 
| 210 #endif  // PPAPI_CPP_VAR_H_ | 214 #endif  // PPAPI_CPP_VAR_H_ | 
| OLD | NEW | 
|---|