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

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

Issue 7655002: Convert the pp::proxy namespace to the ppapi::proxy namespace. (Closed) Base URL: svn://svn.chromium.org/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
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/resource_tracker.h" 5 #include "webkit/plugins/ppapi/resource_tracker.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <set> 8 #include <set>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 PluginInstance* instance; 51 PluginInstance* instance;
52 52
53 // Tracks all live NPObjectVars used by this module so we can map NPObjects 53 // Tracks all live NPObjectVars used by this module so we can map NPObjects
54 // to the corresponding object, and also release these properly if the 54 // to the corresponding object, and also release these properly if the
55 // instance goes away when there are still refs. These are non-owning 55 // instance goes away when there are still refs. These are non-owning
56 // references. 56 // references.
57 NPObjectToNPObjectVarMap np_object_to_object_var; 57 NPObjectToNPObjectVarMap np_object_to_object_var;
58 58
59 // Lazily allocated function proxies for the different interfaces. 59 // Lazily allocated function proxies for the different interfaces.
60 scoped_ptr< ::ppapi::FunctionGroupBase > 60 scoped_ptr< ::ppapi::FunctionGroupBase >
61 function_proxies[::pp::proxy::INTERFACE_ID_COUNT]; 61 function_proxies[::ppapi::proxy::INTERFACE_ID_COUNT];
62 }; 62 };
63 63
64 // static 64 // static
65 ResourceTracker* ResourceTracker::global_tracker_ = NULL; 65 ResourceTracker* ResourceTracker::global_tracker_ = NULL;
66 ResourceTracker* ResourceTracker::singleton_override_ = NULL; 66 ResourceTracker* ResourceTracker::singleton_override_ = NULL;
67 67
68 ResourceTracker::ResourceTracker() 68 ResourceTracker::ResourceTracker()
69 : last_resource_id_(0) { 69 : last_resource_id_(0) {
70 // Wire up the new shared resource tracker base to use our implementation. 70 // Wire up the new shared resource tracker base to use our implementation.
71 ::ppapi::TrackerBase::Init(&GetTrackerBase); 71 ::ppapi::TrackerBase::Init(&GetTrackerBase);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 data.np_object_to_object_var.erase(current->first); 111 data.np_object_to_object_var.erase(current->first);
112 } 112 }
113 DCHECK(data.np_object_to_object_var.empty()); 113 DCHECK(data.np_object_to_object_var.empty());
114 114
115 if (delete_instance) 115 if (delete_instance)
116 instance_map_.erase(found); 116 instance_map_.erase(found);
117 } 117 }
118 118
119 ::ppapi::FunctionGroupBase* ResourceTracker::GetFunctionAPI( 119 ::ppapi::FunctionGroupBase* ResourceTracker::GetFunctionAPI(
120 PP_Instance pp_instance, 120 PP_Instance pp_instance,
121 pp::proxy::InterfaceID id) { 121 ::ppapi::proxy::InterfaceID id) {
122 // Get the instance object. This also ensures that the instance data is in 122 // Get the instance object. This also ensures that the instance data is in
123 // the map, since we need it below. 123 // the map, since we need it below.
124 PluginInstance* instance = GetInstance(pp_instance); 124 PluginInstance* instance = GetInstance(pp_instance);
125 if (!instance) 125 if (!instance)
126 return NULL; 126 return NULL;
127 127
128 // The instance one is special, since it's just implemented by the instance 128 // The instance one is special, since it's just implemented by the instance
129 // object. 129 // object.
130 if (id == pp::proxy::INTERFACE_ID_PPB_INSTANCE) 130 if (id == ::ppapi::proxy::INTERFACE_ID_PPB_INSTANCE)
131 return instance; 131 return instance;
132 132
133 scoped_ptr< ::ppapi::FunctionGroupBase >& proxy = 133 scoped_ptr< ::ppapi::FunctionGroupBase >& proxy =
134 instance_map_[pp_instance]->function_proxies[id]; 134 instance_map_[pp_instance]->function_proxies[id];
135 if (proxy.get()) 135 if (proxy.get())
136 return proxy.get(); 136 return proxy.get();
137 137
138 switch (id) { 138 switch (id) {
139 case pp::proxy::INTERFACE_ID_PPB_CHAR_SET: 139 case ::ppapi::proxy::INTERFACE_ID_PPB_CHAR_SET:
140 proxy.reset(new PPB_CharSet_Impl(instance)); 140 proxy.reset(new PPB_CharSet_Impl(instance));
141 break; 141 break;
142 case pp::proxy::INTERFACE_ID_PPB_CURSORCONTROL: 142 case ::ppapi::proxy::INTERFACE_ID_PPB_CURSORCONTROL:
143 proxy.reset(new PPB_CursorControl_Impl(instance)); 143 proxy.reset(new PPB_CursorControl_Impl(instance));
144 break; 144 break;
145 case pp::proxy::INTERFACE_ID_PPB_FIND: 145 case ::ppapi::proxy::INTERFACE_ID_PPB_FIND:
146 proxy.reset(new PPB_Find_Impl(instance)); 146 proxy.reset(new PPB_Find_Impl(instance));
147 break; 147 break;
148 case pp::proxy::INTERFACE_ID_PPB_FONT: 148 case ::ppapi::proxy::INTERFACE_ID_PPB_FONT:
149 proxy.reset(new PPB_Font_FunctionImpl(instance)); 149 proxy.reset(new PPB_Font_FunctionImpl(instance));
150 break; 150 break;
151 case pp::proxy::INTERFACE_ID_RESOURCE_CREATION: 151 case ::ppapi::proxy::INTERFACE_ID_RESOURCE_CREATION:
152 proxy.reset(new ResourceCreationImpl(instance)); 152 proxy.reset(new ResourceCreationImpl(instance));
153 break; 153 break;
154 default: 154 default:
155 NOTREACHED(); 155 NOTREACHED();
156 } 156 }
157 157
158 return proxy.get(); 158 return proxy.get();
159 } 159 }
160 160
161 ::ppapi::VarTracker* ResourceTracker::GetVarTracker() { 161 ::ppapi::VarTracker* ResourceTracker::GetVarTracker() {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 300
301 // static 301 // static
302 void ResourceTracker::ClearSingletonOverride() { 302 void ResourceTracker::ClearSingletonOverride() {
303 DCHECK(singleton_override_); 303 DCHECK(singleton_override_);
304 singleton_override_ = NULL; 304 singleton_override_ = NULL;
305 } 305 }
306 306
307 } // namespace ppapi 307 } // namespace ppapi
308 } // namespace webkit 308 } // namespace webkit
309 309
OLDNEW
« ppapi/proxy/proxy_non_thread_safe_ref_count.h ('K') | « webkit/plugins/ppapi/resource_tracker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698