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/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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 case pp::proxy::INTERFACE_ID_RESOURCE_CREATION: | 283 case pp::proxy::INTERFACE_ID_RESOURCE_CREATION: |
284 proxy.reset(new ResourceCreationImpl(instance)); | 284 proxy.reset(new ResourceCreationImpl(instance)); |
285 break; | 285 break; |
286 default: | 286 default: |
287 NOTREACHED(); | 287 NOTREACHED(); |
288 } | 288 } |
289 | 289 |
290 return proxy.get(); | 290 return proxy.get(); |
291 } | 291 } |
292 | 292 |
293 PP_Instance ResourceTracker::GetInstanceForResource(PP_Resource pp_resource) { | |
294 scoped_refptr<Resource> resource(GetResource(pp_resource)); | |
295 if (!resource.get()) | |
296 return 0; | |
297 return resource->instance()->pp_instance(); | |
298 } | |
299 | |
300 scoped_refptr<Var> ResourceTracker::GetVar(int32 var_id) const { | 293 scoped_refptr<Var> ResourceTracker::GetVar(int32 var_id) const { |
301 DLOG_IF(ERROR, !CheckIdType(var_id, PP_ID_TYPE_VAR)) | 294 DLOG_IF(ERROR, !CheckIdType(var_id, PP_ID_TYPE_VAR)) |
302 << var_id << " is not a PP_Var ID."; | 295 << var_id << " is not a PP_Var ID."; |
303 VarMap::const_iterator result = live_vars_.find(var_id); | 296 VarMap::const_iterator result = live_vars_.find(var_id); |
304 if (result == live_vars_.end()) | 297 if (result == live_vars_.end()) |
305 return scoped_refptr<Var>(); | 298 return scoped_refptr<Var>(); |
306 return result->second.first; | 299 return result->second.first; |
307 } | 300 } |
308 | 301 |
309 bool ResourceTracker::AddRefVar(int32 var_id) { | 302 bool ResourceTracker::AddRefVar(int32 var_id) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 | 415 |
423 // static | 416 // static |
424 void ResourceTracker::ClearSingletonOverride() { | 417 void ResourceTracker::ClearSingletonOverride() { |
425 DCHECK(singleton_override_); | 418 DCHECK(singleton_override_); |
426 singleton_override_ = NULL; | 419 singleton_override_ = NULL; |
427 } | 420 } |
428 | 421 |
429 } // namespace ppapi | 422 } // namespace ppapi |
430 } // namespace webkit | 423 } // namespace webkit |
431 | 424 |
OLD | NEW |