| 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_var_deprecated.h" | 8 #include "ppapi/c/dev/ppb_var_deprecated.h" |
| 8 #include "ppapi/cpp/private/instance_private.h" | 9 #include "ppapi/cpp/private/instance_private.h" |
| 9 #include "ppapi/cpp/logging.h" | 10 #include "ppapi/cpp/logging.h" |
| 10 #include "ppapi/cpp/module_impl.h" | 11 #include "ppapi/cpp/module_impl.h" |
| 11 #include "ppapi/cpp/dev/scriptable_object_deprecated.h" | 12 #include "ppapi/cpp/dev/scriptable_object_deprecated.h" |
| 12 | 13 |
| 13 namespace pp { | 14 namespace pp { |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 uint32_t prop_count = 0; | 77 uint32_t prop_count = 0; |
| 77 get_interface<PPB_Var_Deprecated>()->GetAllPropertyNames( | 78 get_interface<PPB_Var_Deprecated>()->GetAllPropertyNames( |
| 78 var_, &prop_count, &props, OutException(exception).get()); | 79 var_, &prop_count, &props, OutException(exception).get()); |
| 79 if (!prop_count) | 80 if (!prop_count) |
| 80 return; | 81 return; |
| 81 properties->resize(prop_count); | 82 properties->resize(prop_count); |
| 82 for (uint32_t i = 0; i < prop_count; ++i) { | 83 for (uint32_t i = 0; i < prop_count; ++i) { |
| 83 Var temp(PassRef(), props[i]); | 84 Var temp(PassRef(), props[i]); |
| 84 (*properties)[i] = temp; | 85 (*properties)[i] = temp; |
| 85 } | 86 } |
| 86 Module::Get()->core()->MemFree(props); | 87 const PPB_Memory_Dev* memory_if = static_cast<const PPB_Memory_Dev*>( |
| 88 pp::Module::Get()->GetBrowserInterface(PPB_MEMORY_DEV_INTERFACE)); |
| 89 memory_if->MemFree(props); |
| 87 } | 90 } |
| 88 | 91 |
| 89 void VarPrivate::SetProperty(const Var& name, const Var& value, | 92 void VarPrivate::SetProperty(const Var& name, const Var& value, |
| 90 Var* exception) { | 93 Var* exception) { |
| 91 if (!has_interface<PPB_Var_Deprecated>()) | 94 if (!has_interface<PPB_Var_Deprecated>()) |
| 92 return; | 95 return; |
| 93 get_interface<PPB_Var_Deprecated>()->SetProperty( | 96 get_interface<PPB_Var_Deprecated>()->SetProperty( |
| 94 var_, name.pp_var(), value.pp_var(), OutException(exception).get()); | 97 var_, name.pp_var(), value.pp_var(), OutException(exception).get()); |
| 95 } | 98 } |
| 96 | 99 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 const Var& arg2, const Var& arg3, const Var& arg4, | 180 const Var& arg2, const Var& arg3, const Var& arg4, |
| 178 Var* exception) { | 181 Var* exception) { |
| 179 if (!has_interface<PPB_Var_Deprecated>()) | 182 if (!has_interface<PPB_Var_Deprecated>()) |
| 180 return Var(); | 183 return Var(); |
| 181 PP_Var args[4] = {arg1.pp_var(), arg2.pp_var(), arg3.pp_var(), arg4.pp_var()}; | 184 PP_Var args[4] = {arg1.pp_var(), arg2.pp_var(), arg3.pp_var(), arg4.pp_var()}; |
| 182 return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->Call( | 185 return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->Call( |
| 183 var_, method_name.pp_var(), 4, args, OutException(exception).get())); | 186 var_, method_name.pp_var(), 4, args, OutException(exception).get())); |
| 184 } | 187 } |
| 185 | 188 |
| 186 } // namespace pp | 189 } // namespace pp |
| OLD | NEW |