| OLD | NEW |
| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 } | 141 } |
| 142 | 142 |
| 143 PP_Instance PluginResourceTracker::GetInstanceForResource( | 143 PP_Instance PluginResourceTracker::GetInstanceForResource( |
| 144 PP_Resource resource) { | 144 PP_Resource resource) { |
| 145 ResourceMap::iterator found = resource_map_.find(resource); | 145 ResourceMap::iterator found = resource_map_.find(resource); |
| 146 if (found == resource_map_.end()) | 146 if (found == resource_map_.end()) |
| 147 return 0; | 147 return 0; |
| 148 return found->second.resource->instance(); | 148 return found->second.resource->instance(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 int32 PluginResourceTracker::AddVar(ppapi::Var* var) { | 151 ppapi::VarTracker* PluginResourceTracker::GetVarTracker() { |
| 152 // TODO(brettw) implement this when the proxy uses the Var object in the | 152 return &var_tracker(); |
| 153 // plugin process. | |
| 154 NOTREACHED(); | |
| 155 return 0; | |
| 156 } | |
| 157 | |
| 158 scoped_refptr<ppapi::Var> PluginResourceTracker::GetVar(int32 var_id) const { | |
| 159 // TODO(brettw) implement this when the proxy uses the Var object in the | |
| 160 // plugin process. | |
| 161 NOTREACHED(); | |
| 162 return scoped_refptr<ppapi::Var>(); | |
| 163 } | |
| 164 | |
| 165 bool PluginResourceTracker::AddRefVar(int32 var_id) { | |
| 166 // TODO(brettw) implement this when the proxy uses the Var object in the | |
| 167 // plugin process. | |
| 168 NOTREACHED(); | |
| 169 return false; | |
| 170 } | |
| 171 | |
| 172 bool PluginResourceTracker::UnrefVar(int32 var_id) { | |
| 173 // TODO(brettw) implement this when the proxy uses the Var object in the | |
| 174 // plugin process. | |
| 175 NOTREACHED(); | |
| 176 return false; | |
| 177 } | 153 } |
| 178 | 154 |
| 179 void PluginResourceTracker::ReleasePluginResourceRef( | 155 void PluginResourceTracker::ReleasePluginResourceRef( |
| 180 const PP_Resource& resource, | 156 const PP_Resource& resource, |
| 181 bool notify_browser_on_release) { | 157 bool notify_browser_on_release) { |
| 182 ResourceMap::iterator found = resource_map_.find(resource); | 158 ResourceMap::iterator found = resource_map_.find(resource); |
| 183 if (found == resource_map_.end()) | 159 if (found == resource_map_.end()) |
| 184 return; | 160 return; |
| 185 found->second.ref_count--; | 161 found->second.ref_count--; |
| 186 if (found->second.ref_count == 0) { | 162 if (found->second.ref_count == 0) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 203 // tell the host about. | 179 // tell the host about. |
| 204 if (notify_browser_on_release && dispatcher && !host_resource.is_null()) { | 180 if (notify_browser_on_release && dispatcher && !host_resource.is_null()) { |
| 205 dispatcher->Send(new PpapiHostMsg_PPBCore_ReleaseResource( | 181 dispatcher->Send(new PpapiHostMsg_PPBCore_ReleaseResource( |
| 206 INTERFACE_ID_PPB_CORE, host_resource)); | 182 INTERFACE_ID_PPB_CORE, host_resource)); |
| 207 } | 183 } |
| 208 } | 184 } |
| 209 } | 185 } |
| 210 | 186 |
| 211 } // namespace proxy | 187 } // namespace proxy |
| 212 } // namespace pp | 188 } // namespace pp |
| OLD | NEW |