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

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

Issue 8342016: Revert 106142 - Add a new globals object for PPAPI tracking information. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 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/npapi_glue.cc ('k') | webkit/plugins/ppapi/plugin_module.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:mergeinfo
Merged /branches/chrome_webkit_merge_branch/src/webkit/plugins/ppapi/npobject_var.cc:r3734-4217,4606-5108,5177-5263
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/npobject_var.h" 5 #include "webkit/plugins/ppapi/npobject_var.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ppapi/c/pp_var.h" 8 #include "ppapi/c/pp_var.h"
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
10 #include "webkit/plugins/ppapi/host_globals.h"
11 #include "webkit/plugins/ppapi/resource_tracker.h" 10 #include "webkit/plugins/ppapi/resource_tracker.h"
12 11
13 using webkit::ppapi::HostGlobals;
14 using WebKit::WebBindings; 12 using WebKit::WebBindings;
15 13
16 namespace ppapi { 14 namespace ppapi {
17 15
18 // NPObjectVar ----------------------------------------------------------------- 16 // NPObjectVar -----------------------------------------------------------------
19 17
20 NPObjectVar::NPObjectVar(PP_Module module, 18 NPObjectVar::NPObjectVar(PP_Module module,
21 PP_Instance instance, 19 PP_Instance instance,
22 NPObject* np_object) 20 NPObject* np_object)
23 : Var(module), 21 : Var(module),
24 pp_instance_(instance), 22 pp_instance_(instance),
25 np_object_(np_object) { 23 np_object_(np_object) {
26 WebBindings::retainObject(np_object_); 24 WebBindings::retainObject(np_object_);
27 HostGlobals::Get()->host_resource_tracker()->AddNPObjectVar(this); 25 webkit::ppapi::ResourceTracker::Get()->AddNPObjectVar(this);
28 } 26 }
29 27
30 NPObjectVar::~NPObjectVar() { 28 NPObjectVar::~NPObjectVar() {
31 if (pp_instance()) 29 if (pp_instance())
32 HostGlobals::Get()->host_resource_tracker()->RemoveNPObjectVar(this); 30 webkit::ppapi::ResourceTracker::Get()->RemoveNPObjectVar(this);
33 WebBindings::releaseObject(np_object_); 31 WebBindings::releaseObject(np_object_);
34 } 32 }
35 33
36 NPObjectVar* NPObjectVar::AsNPObjectVar() { 34 NPObjectVar* NPObjectVar::AsNPObjectVar() {
37 return this; 35 return this;
38 } 36 }
39 37
40 PP_Var NPObjectVar::GetPPVar() { 38 PP_Var NPObjectVar::GetPPVar() {
41 int32 id = GetOrCreateVarID(); 39 int32 id = GetOrCreateVarID();
42 if (!id) 40 if (!id)
(...skipping 12 matching lines...) Expand all
55 void NPObjectVar::InstanceDeleted() { 53 void NPObjectVar::InstanceDeleted() {
56 DCHECK(pp_instance_); 54 DCHECK(pp_instance_);
57 pp_instance_ = 0; 55 pp_instance_ = 0;
58 } 56 }
59 57
60 // static 58 // static
61 scoped_refptr<NPObjectVar> NPObjectVar::FromPPVar(PP_Var var) { 59 scoped_refptr<NPObjectVar> NPObjectVar::FromPPVar(PP_Var var) {
62 if (var.type != PP_VARTYPE_OBJECT) 60 if (var.type != PP_VARTYPE_OBJECT)
63 return scoped_refptr<NPObjectVar>(NULL); 61 return scoped_refptr<NPObjectVar>(NULL);
64 scoped_refptr<Var> var_object( 62 scoped_refptr<Var> var_object(
65 PpapiGlobals::Get()->GetVarTracker()->GetVar(var)); 63 webkit::ppapi::ResourceTracker::Get()->GetVarTracker()->GetVar(var));
66 if (!var_object) 64 if (!var_object)
67 return scoped_refptr<NPObjectVar>(); 65 return scoped_refptr<NPObjectVar>();
68 return scoped_refptr<NPObjectVar>(var_object->AsNPObjectVar()); 66 return scoped_refptr<NPObjectVar>(var_object->AsNPObjectVar());
69 } 67 }
70 68
71 } // namespace ppapi 69 } // namespace ppapi
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/npapi_glue.cc ('k') | webkit/plugins/ppapi/plugin_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698