Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(747)

Side by Side Diff: ppapi/shared_impl/scoped_pp_resource.h

Issue 7706021: Convert FileRefImpl and URLRequestInfo to shared_impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tests fixed Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 9
10 namespace ppapi { 10 namespace ppapi {
11 11
12 class Resource; 12 class Resource;
13 13
14 // This is a version of scoped_refptr but for PP_Resources. 14 // This is a version of scoped_refptr but for PP_Resources.
15 class ScopedPPResource { 15 class ScopedPPResource {
16 public: 16 public:
17 struct PassRef {};
18
17 ScopedPPResource(); 19 ScopedPPResource();
18 20
19 // Takes one reference to the given resource. 21 // Takes one reference to the given resource.
20 explicit ScopedPPResource(PP_Resource resource); 22 explicit ScopedPPResource(PP_Resource resource);
21 23
24 // Assumes responsibility for one ref that the resource already has.
25 explicit ScopedPPResource(const PassRef&, PP_Resource resource);
26
22 // Helper to get the PP_Resource out of the given object and take a reference 27 // Helper to get the PP_Resource out of the given object and take a reference
23 // to it. 28 // to it.
24 explicit ScopedPPResource(Resource* resource); 29 explicit ScopedPPResource(Resource* resource);
25 30
26 // Implicit copy constructor allowed. 31 // Implicit copy constructor allowed.
27 ScopedPPResource(const ScopedPPResource& other); 32 ScopedPPResource(const ScopedPPResource& other);
28 33
29 ~ScopedPPResource(); 34 ~ScopedPPResource();
30 35
31 ScopedPPResource& operator=(PP_Resource resource); 36 ScopedPPResource& operator=(PP_Resource resource);
(...skipping 12 matching lines...) Expand all
44 // be unchanged. 49 // be unchanged.
45 void CallAddRef(); 50 void CallAddRef();
46 void CallRelease(); 51 void CallRelease();
47 52
48 PP_Resource id_; 53 PP_Resource id_;
49 }; 54 };
50 55
51 } // namespace ppapi 56 } // namespace ppapi
52 57
53 #endif // PPAPI_SHARED_IMPL_SCOPED_RESOURCE_H_ 58 #endif // PPAPI_SHARED_IMPL_SCOPED_RESOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698