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

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

Issue 7669055: Remove webkit::ppapi::Resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nulls auditeed 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
« no previous file with comments | « ppapi/shared_impl/resource_tracker.cc ('k') | ppapi/shared_impl/scoped_pp_resource.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef PPAPI_SHARED_IMPL_SCOPED_RESOURCE_H_
6 #define PPAPI_SHARED_IMPL_SCOPED_RESOURCE_H_
7
8 #include "ppapi/c/pp_resource.h"
9
10 namespace ppapi {
11
12 class Resource;
13
14 // This is a version of scoped_refptr but for PP_Resources.
15 class ScopedPPResource {
16 public:
17 ScopedPPResource();
18
19 // Takes one reference to the given resource.
20 explicit ScopedPPResource(PP_Resource resource);
21
22 // Helper to get the PP_Resource out of the given object and take a reference
23 // to it.
24 explicit ScopedPPResource(Resource* resource);
25
26 // Implicit copy constructor allowed.
27 ScopedPPResource(const ScopedPPResource& other);
28
29 ~ScopedPPResource();
30
31 ScopedPPResource& operator=(PP_Resource resource);
32 ScopedPPResource& operator=(const ScopedPPResource& resource);
33
34 // Returns the PP_Resource without affecting the refcounting.
35 PP_Resource get() const { return id_; }
36 operator PP_Resource() const { return id_; }
37
38 // Returns the PP_Resource, passing the reference to the caller. This class
39 // will no longer hold the resource.
40 PP_Resource Release();
41
42 private:
43 // Helpers to addref or release the id_ if it's non-NULL. The id_ value will
44 // be unchanged.
45 void CallAddRef();
46 void CallRelease();
47
48 PP_Resource id_;
49 };
50
51 } // namespace ppapi
52
53 #endif // PPAPI_SHARED_IMPL_SCOPED_RESOURCE_H_
OLDNEW
« no previous file with comments | « ppapi/shared_impl/resource_tracker.cc ('k') | ppapi/shared_impl/scoped_pp_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698