| 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 |
| 293 scoped_refptr<Var> ResourceTracker::GetVar(int32 var_id) const { | 300 scoped_refptr<Var> ResourceTracker::GetVar(int32 var_id) const { |
| 294 DLOG_IF(ERROR, !CheckIdType(var_id, PP_ID_TYPE_VAR)) | 301 DLOG_IF(ERROR, !CheckIdType(var_id, PP_ID_TYPE_VAR)) |
| 295 << var_id << " is not a PP_Var ID."; | 302 << var_id << " is not a PP_Var ID."; |
| 296 VarMap::const_iterator result = live_vars_.find(var_id); | 303 VarMap::const_iterator result = live_vars_.find(var_id); |
| 297 if (result == live_vars_.end()) | 304 if (result == live_vars_.end()) |
| 298 return scoped_refptr<Var>(); | 305 return scoped_refptr<Var>(); |
| 299 return result->second.first; | 306 return result->second.first; |
| 300 } | 307 } |
| 301 | 308 |
| 302 bool ResourceTracker::AddRefVar(int32 var_id) { | 309 bool ResourceTracker::AddRefVar(int32 var_id) { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 | 422 |
| 416 // static | 423 // static |
| 417 void ResourceTracker::ClearSingletonOverride() { | 424 void ResourceTracker::ClearSingletonOverride() { |
| 418 DCHECK(singleton_override_); | 425 DCHECK(singleton_override_); |
| 419 singleton_override_ = NULL; | 426 singleton_override_ = NULL; |
| 420 } | 427 } |
| 421 | 428 |
| 422 } // namespace ppapi | 429 } // namespace ppapi |
| 423 } // namespace webkit | 430 } // namespace webkit |
| 424 | 431 |
| OLD | NEW |