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

Side by Side Diff: ppapi/cpp/var.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) 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/var.h" 5 #include "ppapi/cpp/var.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 11
12 #include "ppapi/c/pp_var.h" 12 #include "ppapi/c/pp_var.h"
13 #include "ppapi/c/dev/ppb_memory_dev.h"
dmichael (off chromium) 2011/07/14 05:28:21 nit: This should probably come first alphabeticall
Matt Ball 2011/07/14 15:49:20 Done.
13 #ifndef PPAPI_VAR_REMOVE_SCRIPTING 14 #ifndef PPAPI_VAR_REMOVE_SCRIPTING
14 # include "ppapi/c/dev/ppb_var_deprecated.h" 15 # include "ppapi/c/dev/ppb_var_deprecated.h"
15 #endif 16 #endif
16 #include "ppapi/c/ppb_var.h" 17 #include "ppapi/c/ppb_var.h"
17 #include "ppapi/cpp/instance.h" 18 #include "ppapi/cpp/instance.h"
18 #include "ppapi/cpp/logging.h" 19 #include "ppapi/cpp/logging.h"
19 #include "ppapi/cpp/module.h" 20 #include "ppapi/cpp/module.h"
20 #include "ppapi/cpp/module_impl.h" 21 #include "ppapi/cpp/module_impl.h"
21 #include "ppapi/cpp/dev/scriptable_object_deprecated.h" 22 #include "ppapi/cpp/dev/scriptable_object_deprecated.h"
22 23
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 uint32_t prop_count = 0; 268 uint32_t prop_count = 0;
268 get_interface<PPB_Var_Deprecated>()->GetAllPropertyNames( 269 get_interface<PPB_Var_Deprecated>()->GetAllPropertyNames(
269 var_, &prop_count, &props, OutException(exception).get()); 270 var_, &prop_count, &props, OutException(exception).get());
270 if (!prop_count) 271 if (!prop_count)
271 return; 272 return;
272 properties->resize(prop_count); 273 properties->resize(prop_count);
273 for (uint32_t i = 0; i < prop_count; ++i) { 274 for (uint32_t i = 0; i < prop_count; ++i) {
274 Var temp(PassRef(), props[i]); 275 Var temp(PassRef(), props[i]);
275 (*properties)[i] = temp; 276 (*properties)[i] = temp;
276 } 277 }
277 Module::Get()->core()->MemFree(props); 278 const PPB_Memory_Dev* memory_if = static_cast<const PPB_Memory_Dev*>(
279 pp::Module::Get()->GetBrowserInterface(PPB_MEMORY_DEV_INTERFACE));
280 memory_if->MemFree(props);
278 } 281 }
279 282
280 void Var::SetProperty(const Var& name, const Var& value, Var* exception) { 283 void Var::SetProperty(const Var& name, const Var& value, Var* exception) {
281 if (!has_interface<PPB_Var_Deprecated>()) 284 if (!has_interface<PPB_Var_Deprecated>())
282 return; 285 return;
283 get_interface<PPB_Var_Deprecated>()->SetProperty( 286 get_interface<PPB_Var_Deprecated>()->SetProperty(
284 var_, name.var_, value.var_, OutException(exception).get()); 287 var_, name.var_, value.var_, OutException(exception).get());
285 } 288 }
286 289
287 void Var::RemoveProperty(const Var& name, Var* exception) { 290 void Var::RemoveProperty(const Var& name, Var* exception) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 str.append("..."); 397 str.append("...");
395 } 398 }
396 snprintf(buf, sizeof(buf), format, str.c_str()); 399 snprintf(buf, sizeof(buf), format, str.c_str());
397 } else if (is_object()) { 400 } else if (is_object()) {
398 snprintf(buf, sizeof(buf), "Var<OBJECT>"); 401 snprintf(buf, sizeof(buf), "Var<OBJECT>");
399 } 402 }
400 return buf; 403 return buf;
401 } 404 }
402 405
403 } // namespace pp 406 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698