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/private/instance_private.h" | 10 #include "ppapi/cpp/private/instance_private.h" |
10 #include "ppapi/cpp/logging.h" | 11 #include "ppapi/cpp/logging.h" |
11 #include "ppapi/cpp/module_impl.h" | 12 #include "ppapi/cpp/module_impl.h" |
12 #include "ppapi/cpp/dev/scriptable_object_deprecated.h" | 13 #include "ppapi/cpp/dev/scriptable_object_deprecated.h" |
13 | 14 |
14 namespace pp { | 15 namespace pp { |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 template <> const char* interface_name<PPB_Var_Deprecated>() { | 19 template <> const char* interface_name<PPB_Var_Deprecated>() { |
19 return PPB_VAR_DEPRECATED_INTERFACE; | 20 return PPB_VAR_DEPRECATED_INTERFACE; |
20 } | 21 } |
21 | 22 |
22 } // namespace | 23 } // namespace |
23 | 24 |
24 using namespace deprecated; | 25 using namespace deprecated; |
25 | 26 |
26 VarPrivate::VarPrivate(InstancePrivate* instance, ScriptableObject* object) { | 27 VarPrivate::VarPrivate(const InstanceHandle& instance, |
| 28 ScriptableObject* object) { |
27 if (has_interface<PPB_Var_Deprecated>()) { | 29 if (has_interface<PPB_Var_Deprecated>()) { |
28 var_ = get_interface<PPB_Var_Deprecated>()->CreateObject( | 30 var_ = get_interface<PPB_Var_Deprecated>()->CreateObject( |
29 instance->pp_instance(), object->GetClass(), object); | 31 instance.pp_instance(), object->GetClass(), object); |
30 needs_release_ = true; | 32 needs_release_ = true; |
31 } else { | 33 } else { |
32 var_.type = PP_VARTYPE_NULL; | 34 var_.type = PP_VARTYPE_NULL; |
33 var_.padding = 0; | 35 var_.padding = 0; |
34 needs_release_ = false; | 36 needs_release_ = false; |
35 } | 37 } |
36 } | 38 } |
37 | 39 |
38 ScriptableObject* VarPrivate::AsScriptableObject() const { | 40 ScriptableObject* VarPrivate::AsScriptableObject() const { |
39 if (!is_object()) { | 41 if (!is_object()) { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 const Var& arg2, const Var& arg3, const Var& arg4, | 182 const Var& arg2, const Var& arg3, const Var& arg4, |
181 Var* exception) { | 183 Var* exception) { |
182 if (!has_interface<PPB_Var_Deprecated>()) | 184 if (!has_interface<PPB_Var_Deprecated>()) |
183 return Var(); | 185 return Var(); |
184 PP_Var args[4] = {arg1.pp_var(), arg2.pp_var(), arg3.pp_var(), arg4.pp_var()}; | 186 PP_Var args[4] = {arg1.pp_var(), arg2.pp_var(), arg3.pp_var(), arg4.pp_var()}; |
185 return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->Call( | 187 return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->Call( |
186 var_, method_name.pp_var(), 4, args, OutException(exception).get())); | 188 var_, method_name.pp_var(), 4, args, OutException(exception).get())); |
187 } | 189 } |
188 | 190 |
189 } // namespace pp | 191 } // namespace pp |
OLD | NEW |