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

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

Issue 23809016: [PPAPI] ResourceVar now reference counts its PP_Resource in the plugin. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix Windows compile. Created 7 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
« no previous file with comments | « ppapi/shared_impl/var.cc ('k') | ppapi/shared_impl/var_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_VAR_TRACKER_H_ 5 #ifndef PPAPI_SHARED_IMPL_VAR_TRACKER_H_
6 #define PPAPI_SHARED_IMPL_VAR_TRACKER_H_ 6 #define PPAPI_SHARED_IMPL_VAR_TRACKER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // into the new array buffer. 78 // into the new array buffer.
79 PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes, 79 PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes,
80 base::SharedMemoryHandle h); 80 base::SharedMemoryHandle h);
81 81
82 // Create an ArrayBuffer and copy the contents of |data| in to it. The 82 // Create an ArrayBuffer and copy the contents of |data| in to it. The
83 // returned object has 0 reference count in the tracker, and like all 83 // returned object has 0 reference count in the tracker, and like all
84 // RefCounted objects, has a 0 initial internal reference count. (You should 84 // RefCounted objects, has a 0 initial internal reference count. (You should
85 // usually immediately put this in a scoped_refptr). 85 // usually immediately put this in a scoped_refptr).
86 ArrayBufferVar* MakeArrayBufferVar(uint32 size_in_bytes, const void* data); 86 ArrayBufferVar* MakeArrayBufferVar(uint32 size_in_bytes, const void* data);
87 87
88 // Creates a new resource var that points to a given resource ID. Returns a
89 // PP_Var that references it and has an initial reference count of 1.
90 PP_Var MakeResourcePPVar(PP_Resource pp_resource);
91
92 // Creates a new resource var that points to a given resource ID. This is
93 // implemented by the host and plugin tracker separately, because the plugin
94 // keeps a reference to the resource, and the host does not.
95 virtual ResourceVar* MakeResourceVar(PP_Resource pp_resource) = 0;
96
88 // Return a vector containing all PP_Vars that are in the tracker. This is 97 // Return a vector containing all PP_Vars that are in the tracker. This is
89 // to help implement PPB_Testing_Dev.GetLiveVars and should generally not be 98 // to help implement PPB_Testing_Dev.GetLiveVars and should generally not be
90 // used in production code. The PP_Vars are returned in no particular order, 99 // used in production code. The PP_Vars are returned in no particular order,
91 // and their reference counts are unaffected. 100 // and their reference counts are unaffected.
92 std::vector<PP_Var> GetLiveVars(); 101 std::vector<PP_Var> GetLiveVars();
93 102
94 // Retrieves the internal reference counts for testing. Returns 0 if we 103 // Retrieves the internal reference counts for testing. Returns 0 if we
95 // know about the object but the corresponding value is 0, or -1 if the 104 // know about the object but the corresponding value is 0, or -1 if the
96 // given object ID isn't in our map. 105 // given object ID isn't in our map.
97 int GetRefCountForObject(const PP_Var& object); 106 int GetRefCountForObject(const PP_Var& object);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // other threads (especially the IO thread). On the plugin side, the tracker 215 // other threads (especially the IO thread). On the plugin side, the tracker
207 // is protected by the proxy lock and is thread-safe, so this will be NULL. 216 // is protected by the proxy lock and is thread-safe, so this will be NULL.
208 scoped_ptr<base::ThreadChecker> thread_checker_; 217 scoped_ptr<base::ThreadChecker> thread_checker_;
209 218
210 DISALLOW_COPY_AND_ASSIGN(VarTracker); 219 DISALLOW_COPY_AND_ASSIGN(VarTracker);
211 }; 220 };
212 221
213 } // namespace ppapi 222 } // namespace ppapi
214 223
215 #endif // PPAPI_SHARED_IMPL_VAR_TRACKER_H_ 224 #endif // PPAPI_SHARED_IMPL_VAR_TRACKER_H_
OLDNEW
« no previous file with comments | « ppapi/shared_impl/var.cc ('k') | ppapi/shared_impl/var_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698