OLD | NEW |
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 Loading... |
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 | |
82 // Return a vector containing all PP_Vars that are in the tracker. This is | 76 // Return a vector containing all PP_Vars that are in the tracker. This is |
83 // to help implement PPB_Testing_Dev.GetLiveVars and should generally not be | 77 // to help implement PPB_Testing_Dev.GetLiveVars and should generally not be |
84 // used in production code. The PP_Vars are returned in no particular order, | 78 // used in production code. The PP_Vars are returned in no particular order, |
85 // and their reference counts are unaffected. | 79 // and their reference counts are unaffected. |
86 std::vector<PP_Var> GetLiveVars(); | 80 std::vector<PP_Var> GetLiveVars(); |
87 | 81 |
88 // Retrieves the internal reference counts for testing. Returns 0 if we | 82 // Retrieves the internal reference counts for testing. Returns 0 if we |
89 // know about the object but the corresponding value is 0, or -1 if the | 83 // know about the object but the corresponding value is 0, or -1 if the |
90 // given object ID isn't in our map. | 84 // given object ID isn't in our map. |
91 int GetRefCountForObject(const PP_Var& object); | 85 int GetRefCountForObject(const PP_Var& object); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // implemented by the Host and Plugin tracker separately, so that it can be | 165 // implemented by the Host and Plugin tracker separately, so that it can be |
172 // a real WebKit ArrayBuffer on the host side. | 166 // a real WebKit ArrayBuffer on the host side. |
173 virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) = 0; | 167 virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) = 0; |
174 | 168 |
175 DISALLOW_COPY_AND_ASSIGN(VarTracker); | 169 DISALLOW_COPY_AND_ASSIGN(VarTracker); |
176 }; | 170 }; |
177 | 171 |
178 } // namespace ppapi | 172 } // namespace ppapi |
179 | 173 |
180 #endif // PPAPI_SHARED_IMPL_VAR_TRACKER_H_ | 174 #endif // PPAPI_SHARED_IMPL_VAR_TRACKER_H_ |
OLD | NEW |