| 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 #include "ppapi/cpp/private/var_private.h" | 5 #include "ppapi/cpp/private/var_private.h" |
| 6 | 6 |
| 7 #include "ppapi/c/dev/ppb_memory_dev.h" | 7 #include "ppapi/c/dev/ppb_memory_dev.h" |
| 8 #include "ppapi/c/dev/ppb_var_deprecated.h" | 8 #include "ppapi/c/dev/ppb_var_deprecated.h" |
| 9 #include "ppapi/cpp/instance_handle.h" | 9 #include "ppapi/cpp/instance_handle.h" |
| 10 #include "ppapi/cpp/private/instance_private.h" | 10 #include "ppapi/cpp/private/instance_private.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 } // namespace | 23 } // namespace |
| 24 | 24 |
| 25 using namespace deprecated; | 25 using namespace deprecated; |
| 26 | 26 |
| 27 VarPrivate::VarPrivate(const InstanceHandle& instance, | 27 VarPrivate::VarPrivate(const InstanceHandle& instance, |
| 28 ScriptableObject* object) { | 28 ScriptableObject* object) { |
| 29 if (has_interface<PPB_Var_Deprecated>()) { | 29 if (has_interface<PPB_Var_Deprecated>()) { |
| 30 var_ = get_interface<PPB_Var_Deprecated>()->CreateObject( | 30 var_ = get_interface<PPB_Var_Deprecated>()->CreateObject( |
| 31 instance.pp_instance(), object->GetClass(), object); | 31 instance.pp_instance(), object->GetClass(), object); |
| 32 needs_release_ = true; | |
| 33 } else { | 32 } else { |
| 34 var_.type = PP_VARTYPE_NULL; | 33 var_.type = PP_VARTYPE_NULL; |
| 35 var_.padding = 0; | 34 var_.padding = 0; |
| 36 needs_release_ = false; | |
| 37 } | 35 } |
| 36 is_managed_ = true; |
| 38 } | 37 } |
| 39 | 38 |
| 40 ScriptableObject* VarPrivate::AsScriptableObject() const { | 39 ScriptableObject* VarPrivate::AsScriptableObject() const { |
| 41 if (!is_object()) { | 40 if (!is_object()) { |
| 42 PP_NOTREACHED(); | 41 PP_NOTREACHED(); |
| 43 } else if (has_interface<PPB_Var_Deprecated>()) { | 42 } else if (has_interface<PPB_Var_Deprecated>()) { |
| 44 void* object = NULL; | 43 void* object = NULL; |
| 45 if (get_interface<PPB_Var_Deprecated>()->IsInstanceOf( | 44 if (get_interface<PPB_Var_Deprecated>()->IsInstanceOf( |
| 46 var_, ScriptableObject::GetClass(), &object)) { | 45 var_, ScriptableObject::GetClass(), &object)) { |
| 47 return reinterpret_cast<ScriptableObject*>(object); | 46 return reinterpret_cast<ScriptableObject*>(object); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 const Var& arg2, const Var& arg3, const Var& arg4, | 181 const Var& arg2, const Var& arg3, const Var& arg4, |
| 183 Var* exception) { | 182 Var* exception) { |
| 184 if (!has_interface<PPB_Var_Deprecated>()) | 183 if (!has_interface<PPB_Var_Deprecated>()) |
| 185 return Var(); | 184 return Var(); |
| 186 PP_Var args[4] = {arg1.pp_var(), arg2.pp_var(), arg3.pp_var(), arg4.pp_var()}; | 185 PP_Var args[4] = {arg1.pp_var(), arg2.pp_var(), arg3.pp_var(), arg4.pp_var()}; |
| 187 return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->Call( | 186 return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->Call( |
| 188 var_, method_name.pp_var(), 4, args, OutException(exception).get())); | 187 var_, method_name.pp_var(), 4, args, OutException(exception).get())); |
| 189 } | 188 } |
| 190 | 189 |
| 191 } // namespace pp | 190 } // namespace pp |
| OLD | NEW |