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 #ifndef PPAPI_SHARED_IMPL_SCOPED_RESOURCE_H_ | 5 #ifndef PPAPI_SHARED_IMPL_SCOPED_RESOURCE_H_ |
6 #define PPAPI_SHARED_IMPL_SCOPED_RESOURCE_H_ | 6 #define PPAPI_SHARED_IMPL_SCOPED_RESOURCE_H_ |
7 | 7 |
8 #include "ppapi/c/pp_resource.h" | 8 #include "ppapi/c/pp_resource.h" |
| 9 #include "ppapi/shared_impl/ppapi_shared_export.h" |
9 | 10 |
10 namespace ppapi { | 11 namespace ppapi { |
11 | 12 |
12 class Resource; | 13 class Resource; |
13 | 14 |
14 // This is a version of scoped_refptr but for PP_Resources. | 15 // This is a version of scoped_refptr but for PP_Resources. |
15 class ScopedPPResource { | 16 class PPAPI_SHARED_EXPORT ScopedPPResource { |
16 public: | 17 public: |
17 struct PassRef {}; | 18 struct PassRef {}; |
18 | 19 |
19 ScopedPPResource(); | 20 ScopedPPResource(); |
20 | 21 |
21 // Takes one reference to the given resource. | 22 // Takes one reference to the given resource. |
22 explicit ScopedPPResource(PP_Resource resource); | 23 explicit ScopedPPResource(PP_Resource resource); |
23 | 24 |
24 // Assumes responsibility for one ref that the resource already has. | 25 // Assumes responsibility for one ref that the resource already has. |
25 explicit ScopedPPResource(const PassRef&, PP_Resource resource); | 26 explicit ScopedPPResource(const PassRef&, PP_Resource resource); |
(...skipping 23 matching lines...) Expand all Loading... |
49 // be unchanged. | 50 // be unchanged. |
50 void CallAddRef(); | 51 void CallAddRef(); |
51 void CallRelease(); | 52 void CallRelease(); |
52 | 53 |
53 PP_Resource id_; | 54 PP_Resource id_; |
54 }; | 55 }; |
55 | 56 |
56 } // namespace ppapi | 57 } // namespace ppapi |
57 | 58 |
58 #endif // PPAPI_SHARED_IMPL_SCOPED_RESOURCE_H_ | 59 #endif // PPAPI_SHARED_IMPL_SCOPED_RESOURCE_H_ |
OLD | NEW |