| 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 "ppapi/shared_impl/scoped_pp_resource.h" | 5 #include "ppapi/shared_impl/scoped_pp_resource.h" |
| 6 | 6 |
| 7 #include "ppapi/shared_impl/ppapi_globals.h" |
| 7 #include "ppapi/shared_impl/resource.h" | 8 #include "ppapi/shared_impl/resource.h" |
| 8 #include "ppapi/shared_impl/resource_tracker.h" | 9 #include "ppapi/shared_impl/resource_tracker.h" |
| 9 #include "ppapi/shared_impl/tracker_base.h" | |
| 10 | 10 |
| 11 namespace ppapi { | 11 namespace ppapi { |
| 12 | 12 |
| 13 ScopedPPResource::ScopedPPResource() : id_(0) { | 13 ScopedPPResource::ScopedPPResource() : id_(0) { |
| 14 } | 14 } |
| 15 | 15 |
| 16 ScopedPPResource::ScopedPPResource(PP_Resource resource) : id_(resource) { | 16 ScopedPPResource::ScopedPPResource(PP_Resource resource) : id_(resource) { |
| 17 CallAddRef(); | 17 CallAddRef(); |
| 18 } | 18 } |
| 19 | 19 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 PP_Resource ScopedPPResource::Release() { | 57 PP_Resource ScopedPPResource::Release() { |
| 58 CallRelease(); | 58 CallRelease(); |
| 59 | 59 |
| 60 PP_Resource ret = id_; | 60 PP_Resource ret = id_; |
| 61 id_ = 0; | 61 id_ = 0; |
| 62 return ret; | 62 return ret; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void ScopedPPResource::CallAddRef() { | 65 void ScopedPPResource::CallAddRef() { |
| 66 if (id_) | 66 if (id_) |
| 67 TrackerBase::Get()->GetResourceTracker()->AddRefResource(id_); | 67 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(id_); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void ScopedPPResource::CallRelease() { | 70 void ScopedPPResource::CallRelease() { |
| 71 if (id_) | 71 if (id_) |
| 72 TrackerBase::Get()->GetResourceTracker()->ReleaseResource(id_); | 72 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(id_); |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace ppapi | 75 } // namespace ppapi |
| OLD | NEW |