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

Side by Side Diff: webkit/plugins/ppapi/ppb_var_impl.cc

Issue 7578001: Unify var tracking between webkit and the proxy. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
« no previous file with comments | « webkit/plugins/ppapi/ppb_url_util_impl.cc ('k') | webkit/plugins/ppapi/resource_tracker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "webkit/plugins/ppapi/ppb_var_impl.h" 5 #include "webkit/plugins/ppapi/ppb_var_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "ppapi/c/dev/ppb_var_deprecated.h" 9 #include "ppapi/c/dev/ppb_var_deprecated.h"
10 #include "ppapi/c/ppb_var.h" 10 #include "ppapi/c/ppb_var.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 NPIdentifier identifier() const { return identifier_; } 162 NPIdentifier identifier() const { return identifier_; }
163 163
164 private: 164 private:
165 NPIdentifier identifier_; 165 NPIdentifier identifier_;
166 166
167 DISALLOW_COPY_AND_ASSIGN(ObjectAccessorWithIdentifierTryCatch); 167 DISALLOW_COPY_AND_ASSIGN(ObjectAccessorWithIdentifierTryCatch);
168 }; 168 };
169 169
170 // PPB_Var methods ------------------------------------------------------------- 170 // PPB_Var methods -------------------------------------------------------------
171 171
172 void AddRefVar(PP_Var var) {
173 ResourceTracker::Get()->GetVarTracker()->AddRefVar(var);
174 }
175
176 void ReleaseVar(PP_Var var) {
177 ResourceTracker::Get()->GetVarTracker()->ReleaseVar(var);
178 }
179
172 PP_Var VarFromUtf8(PP_Module module, const char* data, uint32_t len) { 180 PP_Var VarFromUtf8(PP_Module module, const char* data, uint32_t len) {
173 return StringVar::StringToPPVar(module, data, len); 181 return StringVar::StringToPPVar(module, data, len);
174 } 182 }
175 183
176 const char* VarToUtf8(PP_Var var, uint32_t* len) { 184 const char* VarToUtf8(PP_Var var, uint32_t* len) {
177 scoped_refptr<StringVar> str(StringVar::FromPPVar(var)); 185 scoped_refptr<StringVar> str(StringVar::FromPPVar(var));
178 if (!str) { 186 if (!str) {
179 *len = 0; 187 *len = 0;
180 return NULL; 188 return NULL;
181 } 189 }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 const PPP_Class_Deprecated* ppp_class, 419 const PPP_Class_Deprecated* ppp_class,
412 void* ppp_class_data) { 420 void* ppp_class_data) {
413 PluginModule* module = ResourceTracker::Get()->GetModule(module_id); 421 PluginModule* module = ResourceTracker::Get()->GetModule(module_id);
414 if (!module) 422 if (!module)
415 return PP_MakeNull(); 423 return PP_MakeNull();
416 return PluginObject::Create(module->GetSomeInstance(), 424 return PluginObject::Create(module->GetSomeInstance(),
417 ppp_class, ppp_class_data); 425 ppp_class, ppp_class_data);
418 } 426 }
419 427
420 const PPB_Var_Deprecated var_deprecated_interface = { 428 const PPB_Var_Deprecated var_deprecated_interface = {
421 &Var::PluginAddRefPPVar, 429 &AddRefVar,
422 &Var::PluginReleasePPVar, 430 &ReleaseVar,
423 &VarFromUtf8, 431 &VarFromUtf8,
424 &VarToUtf8, 432 &VarToUtf8,
425 &HasPropertyDeprecated, 433 &HasPropertyDeprecated,
426 &HasMethodDeprecated, 434 &HasMethodDeprecated,
427 &GetProperty, 435 &GetProperty,
428 &EnumerateProperties, 436 &EnumerateProperties,
429 &SetPropertyDeprecated, 437 &SetPropertyDeprecated,
430 &DeletePropertyDeprecated, 438 &DeletePropertyDeprecated,
431 &CallDeprecated, 439 &CallDeprecated,
432 &Construct, 440 &Construct,
433 &IsInstanceOfDeprecated, 441 &IsInstanceOfDeprecated,
434 &CreateObjectDeprecated, 442 &CreateObjectDeprecated,
435 &CreateObjectWithModuleDeprecated, 443 &CreateObjectWithModuleDeprecated,
436 }; 444 };
437 445
438 const PPB_Var var_interface = { 446 const PPB_Var var_interface = {
439 &Var::PluginAddRefPPVar, 447 &AddRefVar,
440 &Var::PluginReleasePPVar, 448 &ReleaseVar,
441 &VarFromUtf8, 449 &VarFromUtf8,
442 &VarToUtf8 450 &VarToUtf8
443 }; 451 };
444 452
445 } // namespace 453 } // namespace
446 454
447 // static 455 // static
448 const PPB_Var* PPB_Var_Impl::GetVarInterface() { 456 const PPB_Var* PPB_Var_Impl::GetVarInterface() {
449 return &var_interface; 457 return &var_interface;
450 } 458 }
451 459
452 // static 460 // static
453 const PPB_Var_Deprecated* PPB_Var_Impl::GetVarDeprecatedInterface() { 461 const PPB_Var_Deprecated* PPB_Var_Impl::GetVarDeprecatedInterface() {
454 return &var_deprecated_interface; 462 return &var_deprecated_interface;
455 } 463 }
456 464
457 } // namespace ppapi 465 } // namespace ppapi
458 } // namespace webkit 466 } // namespace webkit
459 467
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_url_util_impl.cc ('k') | webkit/plugins/ppapi/resource_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698