| OLD | NEW |
| 1 // Copyright (c) 2010 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2010 The Native Client 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 "native_client/src/shared/ppapi_proxy/plugin_resource.h" | 5 #include "native_client/src/shared/ppapi_proxy/plugin_resource.h" |
| 6 | 6 |
| 7 namespace ppapi_proxy { | 7 namespace ppapi_proxy { |
| 8 | 8 |
| 9 PluginResource::PluginResource(PluginModule* module) | 9 PluginResource::PluginResource() |
| 10 : resource_id_(0), module_(module) { | 10 : resource_id_(0) { |
| 11 } | 11 } |
| 12 | 12 |
| 13 PluginResource::~PluginResource() { | 13 PluginResource::~PluginResource() { |
| 14 } | 14 } |
| 15 | 15 |
| 16 PP_Resource PluginResource::GetReference() { | 16 PP_Resource PluginResource::GetReference() { |
| 17 PluginResourceTracker *tracker = PluginResourceTracker::Get(); | 17 PluginResourceTracker::Get()->AddRefResource(resource_id_); |
| 18 if (resource_id_) | |
| 19 tracker->AddRefResource(resource_id_); | |
| 20 else | |
| 21 resource_id_ = tracker->AddResource(this); | |
| 22 return resource_id_; | 18 return resource_id_; |
| 23 } | 19 } |
| 24 | 20 |
| 25 void PluginResource::StoppedTracking() { | 21 void PluginResource::StoppedTracking() { |
| 26 resource_id_ = 0; | 22 resource_id_ = 0; |
| 27 } | 23 } |
| 28 | 24 |
| 29 } // namespace ppapi_proxy | 25 } // namespace ppapi_proxy |
| 30 | 26 |
| OLD | NEW |