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

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

Issue 12096099: PPAPI: Fix WebSocket Var ref leak receiving binary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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) 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // be deleted if there are no more refs to it. 66 // be deleted if there are no more refs to it.
67 bool ReleaseVar(int32 var_id); 67 bool ReleaseVar(int32 var_id);
68 bool ReleaseVar(const PP_Var& var); 68 bool ReleaseVar(const PP_Var& var);
69 69
70 // Create a new array buffer of size |size_in_bytes|. Return a PP_Var that 70 // Create a new array buffer of size |size_in_bytes|. Return a PP_Var that
71 // that references it and has an initial reference-count of 1. 71 // that references it and has an initial reference-count of 1.
72 PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes); 72 PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes);
73 // Same as above, but copy the contents of |data| in to the new array buffer. 73 // Same as above, but copy the contents of |data| in to the new array buffer.
74 PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes, const void* data); 74 PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes, const void* data);
75 75
76 // Create an ArrayBuffer and copy the contents of |data| in to it. The
77 // returned object has 0 reference count in the tracker, and like all
78 // RefCounted objects, has a 0 initial internal reference count. (You should
79 // usually immediately put this in a scoped_refptr).
80 ArrayBufferVar* MakeArrayBufferVar(uint32 size_in_bytes, const void* data);
81
76 // Return a vector containing all PP_Vars that are in the tracker. This is 82 // Return a vector containing all PP_Vars that are in the tracker. This is
77 // to help implement PPB_Testing_Dev.GetLiveVars and should generally not be 83 // to help implement PPB_Testing_Dev.GetLiveVars and should generally not be
78 // used in production code. The PP_Vars are returned in no particular order, 84 // used in production code. The PP_Vars are returned in no particular order,
79 // and their reference counts are unaffected. 85 // and their reference counts are unaffected.
80 std::vector<PP_Var> GetLiveVars(); 86 std::vector<PP_Var> GetLiveVars();
81 87
82 // Retrieves the internal reference counts for testing. Returns 0 if we 88 // Retrieves the internal reference counts for testing. Returns 0 if we
83 // know about the object but the corresponding value is 0, or -1 if the 89 // know about the object but the corresponding value is 0, or -1 if the
84 // given object ID isn't in our map. 90 // given object ID isn't in our map.
85 int GetRefCountForObject(const PP_Var& object); 91 int GetRefCountForObject(const PP_Var& object);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // implemented by the Host and Plugin tracker separately, so that it can be 171 // implemented by the Host and Plugin tracker separately, so that it can be
166 // a real WebKit ArrayBuffer on the host side. 172 // a real WebKit ArrayBuffer on the host side.
167 virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) = 0; 173 virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) = 0;
168 174
169 DISALLOW_COPY_AND_ASSIGN(VarTracker); 175 DISALLOW_COPY_AND_ASSIGN(VarTracker);
170 }; 176 };
171 177
172 } // namespace ppapi 178 } // namespace ppapi
173 179
174 #endif // PPAPI_SHARED_IMPL_VAR_TRACKER_H_ 180 #endif // PPAPI_SHARED_IMPL_VAR_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698