| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cpp/resource.h" | 5 #include "ppapi/cpp/resource.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ppapi/cpp/logging.h" | 9 #include "ppapi/cpp/logging.h" |
| 10 #include "ppapi/cpp/module.h" | 10 #include "ppapi/cpp/module.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 Resource::Resource(PassRef, PP_Resource resource) : pp_resource_(resource) { | 47 Resource::Resource(PassRef, PP_Resource resource) : pp_resource_(resource) { |
| 48 } | 48 } |
| 49 | 49 |
| 50 void Resource::PassRefFromConstructor(PP_Resource resource) { | 50 void Resource::PassRefFromConstructor(PP_Resource resource) { |
| 51 PP_DCHECK(!pp_resource_); | 51 PP_DCHECK(!pp_resource_); |
| 52 pp_resource_ = resource; | 52 pp_resource_ = resource; |
| 53 } | 53 } |
| 54 | 54 |
| 55 void Resource::Clear() { |
| 56 if (is_null()) |
| 57 return; |
| 58 Module::Get()->core()->ReleaseResource(pp_resource_); |
| 59 pp_resource_ = 0; |
| 60 } |
| 61 |
| 55 } // namespace pp | 62 } // namespace pp |
| OLD | NEW |