| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/host_globals.h" | 5 #include "webkit/plugins/ppapi/host_globals.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 !instance->module()->ReserveInstanceID(new_instance)); | 233 !instance->module()->ReserveInstanceID(new_instance)); |
| 234 | 234 |
| 235 instance_map_[new_instance] = instance; | 235 instance_map_[new_instance] = instance; |
| 236 | 236 |
| 237 resource_tracker_.DidCreateInstance(new_instance); | 237 resource_tracker_.DidCreateInstance(new_instance); |
| 238 return new_instance; | 238 return new_instance; |
| 239 } | 239 } |
| 240 | 240 |
| 241 void HostGlobals::InstanceDeleted(PP_Instance instance) { | 241 void HostGlobals::InstanceDeleted(PP_Instance instance) { |
| 242 resource_tracker_.DidDeleteInstance(instance); | 242 resource_tracker_.DidDeleteInstance(instance); |
| 243 host_var_tracker_.ForceFreeNPObjectsForInstance(instance); | 243 host_var_tracker_.DidDeleteInstance(instance); |
| 244 instance_map_.erase(instance); | 244 instance_map_.erase(instance); |
| 245 } | 245 } |
| 246 | 246 |
| 247 void HostGlobals::InstanceCrashed(PP_Instance instance) { | 247 void HostGlobals::InstanceCrashed(PP_Instance instance) { |
| 248 resource_tracker_.DidDeleteInstance(instance); | 248 resource_tracker_.DidDeleteInstance(instance); |
| 249 host_var_tracker_.ForceFreeNPObjectsForInstance(instance); | 249 host_var_tracker_.DidDeleteInstance(instance); |
| 250 } | 250 } |
| 251 | 251 |
| 252 PluginInstance* HostGlobals::GetInstance(PP_Instance instance) { | 252 PluginInstance* HostGlobals::GetInstance(PP_Instance instance) { |
| 253 DLOG_IF(ERROR, !CheckIdType(instance, ::ppapi::PP_ID_TYPE_INSTANCE)) | 253 DLOG_IF(ERROR, !CheckIdType(instance, ::ppapi::PP_ID_TYPE_INSTANCE)) |
| 254 << instance << " is not a PP_Instance."; | 254 << instance << " is not a PP_Instance."; |
| 255 InstanceMap::iterator found = instance_map_.find(instance); | 255 InstanceMap::iterator found = instance_map_.find(instance); |
| 256 if (found == instance_map_.end()) | 256 if (found == instance_map_.end()) |
| 257 return NULL; | 257 return NULL; |
| 258 return found->second; | 258 return found->second; |
| 259 } | 259 } |
| 260 | 260 |
| 261 bool HostGlobals::IsHostGlobals() const { | 261 bool HostGlobals::IsHostGlobals() const { |
| 262 return true; | 262 return true; |
| 263 } | 263 } |
| 264 | 264 |
| 265 } // namespace ppapi | 265 } // namespace ppapi |
| 266 } // namespace webkit | 266 } // namespace webkit |
| OLD | NEW |