| 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 "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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 ::ppapi::ResourceTracker* HostGlobals::GetResourceTracker() { | 53 ::ppapi::ResourceTracker* HostGlobals::GetResourceTracker() { |
| 54 return &host_resource_tracker_; | 54 return &host_resource_tracker_; |
| 55 } | 55 } |
| 56 | 56 |
| 57 ::ppapi::VarTracker* HostGlobals::GetVarTracker() { | 57 ::ppapi::VarTracker* HostGlobals::GetVarTracker() { |
| 58 return &host_var_tracker_; | 58 return &host_var_tracker_; |
| 59 } | 59 } |
| 60 | 60 |
| 61 ::ppapi::CallbackTracker* HostGlobals::GetCallbackTrackerForInstance( |
| 62 PP_Instance instance) { |
| 63 std::map<PP_Instance, linked_ptr<InstanceData> >::iterator found = |
| 64 instance_map_.find(instance); |
| 65 if (found == instance_map_.end()) |
| 66 return NULL; |
| 67 |
| 68 return found->second->instance->module()->GetNewCallbackTracker(); |
| 69 } |
| 70 |
| 61 ::ppapi::FunctionGroupBase* HostGlobals::GetFunctionAPI(PP_Instance pp_instance, | 71 ::ppapi::FunctionGroupBase* HostGlobals::GetFunctionAPI(PP_Instance pp_instance, |
| 62 ::ppapi::ApiID id) { | 72 ::ppapi::ApiID id) { |
| 63 // Get the instance object. This also ensures that the instance data is in | 73 // Get the instance object. This also ensures that the instance data is in |
| 64 // the map, since we need it below. | 74 // the map, since we need it below. |
| 65 PluginInstance* instance = GetInstance(pp_instance); | 75 PluginInstance* instance = GetInstance(pp_instance); |
| 66 if (!instance) | 76 if (!instance) |
| 67 return NULL; | 77 return NULL; |
| 68 | 78 |
| 69 // The instance one is special, since it's just implemented by the instance | 79 // The instance one is special, since it's just implemented by the instance |
| 70 // object. | 80 // object. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 DLOG_IF(ERROR, !CheckIdType(instance, ::ppapi::PP_ID_TYPE_INSTANCE)) | 192 DLOG_IF(ERROR, !CheckIdType(instance, ::ppapi::PP_ID_TYPE_INSTANCE)) |
| 183 << instance << " is not a PP_Instance."; | 193 << instance << " is not a PP_Instance."; |
| 184 InstanceMap::iterator found = instance_map_.find(instance); | 194 InstanceMap::iterator found = instance_map_.find(instance); |
| 185 if (found == instance_map_.end()) | 195 if (found == instance_map_.end()) |
| 186 return NULL; | 196 return NULL; |
| 187 return found->second->instance; | 197 return found->second->instance; |
| 188 } | 198 } |
| 189 | 199 |
| 190 } // namespace ppapi | 200 } // namespace ppapi |
| 191 } // namespace webkit | 201 } // namespace webkit |
| OLD | NEW |