Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: ppapi/cpp/dev/scriptable_object_deprecated.cc

Issue 7349016: Added versioning for PPB_Core::MemAlloc and MemFree (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor cleanup Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "ppapi/cpp/dev/scriptable_object_deprecated.h" 5 #include "ppapi/cpp/dev/scriptable_object_deprecated.h"
6 6 #include "ppapi/c/dev/ppb_memory_dev.h"
7 #include "ppapi/c/dev/ppp_class_deprecated.h" 7 #include "ppapi/c/dev/ppp_class_deprecated.h"
8 #include "ppapi/cpp/module.h" 8 #include "ppapi/cpp/module.h"
9 #include "ppapi/cpp/var.h" 9 #include "ppapi/cpp/var.h"
10 10
11 namespace pp { 11 namespace pp {
12 12
13 namespace deprecated { 13 namespace deprecated {
14 14
15 namespace { 15 namespace {
16 16
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 void GetAllPropertyNames(void* object, 63 void GetAllPropertyNames(void* object,
64 uint32_t* property_count, 64 uint32_t* property_count,
65 PP_Var** properties, 65 PP_Var** properties,
66 PP_Var* exception) { 66 PP_Var* exception) {
67 ExceptionConverter e(exception); 67 ExceptionConverter e(exception);
68 std::vector<Var> props; 68 std::vector<Var> props;
69 static_cast<ScriptableObject*>(object)->GetAllPropertyNames(&props, e.Get()); 69 static_cast<ScriptableObject*>(object)->GetAllPropertyNames(&props, e.Get());
70 if (props.empty()) 70 if (props.empty())
71 return; 71 return;
72 *property_count = static_cast<uint32_t>(props.size()); 72 *property_count = static_cast<uint32_t>(props.size());
73
74 const PPB_Memory_Dev* memory_if = static_cast<const PPB_Memory_Dev*>(
75 pp::Module::Get()->GetBrowserInterface(PPB_MEMORY_DEV_INTERFACE));
73 *properties = static_cast<PP_Var*>( 76 *properties = static_cast<PP_Var*>(
74 Module::Get()->core()->MemAlloc(sizeof(PP_Var) * props.size())); 77 memory_if->MemAlloc(sizeof(PP_Var) * props.size()));
78
75 for (size_t i = 0; i < props.size(); ++i) 79 for (size_t i = 0; i < props.size(); ++i)
76 (*properties)[i] = props[i].Detach(); 80 (*properties)[i] = props[i].Detach();
77 } 81 }
78 82
79 void SetProperty(void* object, 83 void SetProperty(void* object,
80 PP_Var name, 84 PP_Var name,
81 PP_Var value, 85 PP_Var value,
82 PP_Var* exception) { 86 PP_Var* exception) {
83 ExceptionConverter e(exception); 87 ExceptionConverter e(exception);
84 static_cast<ScriptableObject*>(object)->SetProperty( 88 static_cast<ScriptableObject*>(object)->SetProperty(
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 183 }
180 184
181 // static 185 // static
182 const PPP_Class_Deprecated* ScriptableObject::GetClass() { 186 const PPP_Class_Deprecated* ScriptableObject::GetClass() {
183 return &plugin_class; 187 return &plugin_class;
184 } 188 }
185 189
186 } // namespace deprecated 190 } // namespace deprecated
187 191
188 } // namespace pp 192 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/core.h ('k') | ppapi/cpp/private/var_private.cc » ('j') | ppapi/cpp/var.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698