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

Side by Side Diff: ppapi/proxy/plugin_resource_tracker.cc

Issue 7105013: Convert more interfaces to the new thunk system. This goes up to and including (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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 | « ppapi/proxy/plugin_resource_tracker.h ('k') | ppapi/proxy/ppb_audio_config_proxy.cc » ('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 "ppapi/proxy/plugin_resource_tracker.h" 5 #include "ppapi/proxy/plugin_resource_tracker.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "ppapi/proxy/plugin_dispatcher.h" 9 #include "ppapi/proxy/plugin_dispatcher.h"
10 #include "ppapi/proxy/ppapi_messages.h" 10 #include "ppapi/proxy/ppapi_messages.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 ::ppapi::FunctionGroupBase* PluginResourceTracker::GetFunctionAPI( 133 ::ppapi::FunctionGroupBase* PluginResourceTracker::GetFunctionAPI(
134 PP_Instance inst, 134 PP_Instance inst,
135 pp::proxy::InterfaceID id) { 135 pp::proxy::InterfaceID id) {
136 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(inst); 136 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(inst);
137 if (dispatcher) 137 if (dispatcher)
138 return dispatcher->GetFunctionAPI(id); 138 return dispatcher->GetFunctionAPI(id);
139 return NULL; 139 return NULL;
140 } 140 }
141 141
142 PP_Instance PluginResourceTracker::GetInstanceForResource(
143 PP_Resource resource) {
144 ResourceMap::iterator found = resource_map_.find(resource);
145 if (found == resource_map_.end())
146 return 0;
147 return found->second.resource->instance();
148 }
149
142 void PluginResourceTracker::ReleasePluginResourceRef( 150 void PluginResourceTracker::ReleasePluginResourceRef(
143 const PP_Resource& resource, 151 const PP_Resource& resource,
144 bool notify_browser_on_release) { 152 bool notify_browser_on_release) {
145 ResourceMap::iterator found = resource_map_.find(resource); 153 ResourceMap::iterator found = resource_map_.find(resource);
146 if (found == resource_map_.end()) 154 if (found == resource_map_.end())
147 return; 155 return;
148 found->second.ref_count--; 156 found->second.ref_count--;
149 if (found->second.ref_count == 0) { 157 if (found->second.ref_count == 0) {
150 // Keep a reference while removing in case the destructor ends up 158 // Keep a reference while removing in case the destructor ends up
151 // re-entering. That way, when the destructor is called, it's out of the 159 // re-entering. That way, when the destructor is called, it's out of the
(...skipping 14 matching lines...) Expand all
166 // tell the host about. 174 // tell the host about.
167 if (notify_browser_on_release && dispatcher && !host_resource.is_null()) { 175 if (notify_browser_on_release && dispatcher && !host_resource.is_null()) {
168 dispatcher->Send(new PpapiHostMsg_PPBCore_ReleaseResource( 176 dispatcher->Send(new PpapiHostMsg_PPBCore_ReleaseResource(
169 INTERFACE_ID_PPB_CORE, host_resource)); 177 INTERFACE_ID_PPB_CORE, host_resource));
170 } 178 }
171 } 179 }
172 } 180 }
173 181
174 } // namespace proxy 182 } // namespace proxy
175 } // namespace pp 183 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_resource_tracker.h ('k') | ppapi/proxy/ppb_audio_config_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698