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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // Decreases the given Var ID's refcount, returning true on success, false if | 54 // Decreases the given Var ID's refcount, returning true on success, false if |
55 // the ID is invalid or if the refcount was already 0. The PP_Var version | 55 // the ID is invalid or if the refcount was already 0. The PP_Var version |
56 // returns true and does nothing for non-refcounted type vars. The var will | 56 // returns true and does nothing for non-refcounted type vars. The var will |
57 // be deleted if there are no more refs to it. | 57 // be deleted if there are no more refs to it. |
58 bool ReleaseVar(int32 var_id); | 58 bool ReleaseVar(int32 var_id); |
59 bool ReleaseVar(const PP_Var& var); | 59 bool ReleaseVar(const PP_Var& var); |
60 | 60 |
61 // Create a new array buffer of size |size_in_bytes|. Return a PP_Var that | 61 // Create a new array buffer of size |size_in_bytes|. Return a PP_Var that |
62 // that references it and has an initial reference-count of 1. | 62 // that references it and has an initial reference-count of 1. |
63 PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes); | 63 PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes); |
| 64 // Same as above, but copy the contents of |data| in to the new array buffer. |
| 65 PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes, const void* data); |
64 | 66 |
65 // Return a vector containing all PP_Vars that are in the tracker. This is | 67 // Return a vector containing all PP_Vars that are in the tracker. This is |
66 // to help implement PPB_Testing_Dev.GetLiveVars and should generally not be | 68 // to help implement PPB_Testing_Dev.GetLiveVars and should generally not be |
67 // used in production code. The PP_Vars are returned in no particular order, | 69 // used in production code. The PP_Vars are returned in no particular order, |
68 // and their reference counts are unaffected. | 70 // and their reference counts are unaffected. |
69 std::vector<PP_Var> GetLiveVars(); | 71 std::vector<PP_Var> GetLiveVars(); |
70 | 72 |
71 // Retrieves the internal reference counts for testing. Returns 0 if we | 73 // Retrieves the internal reference counts for testing. Returns 0 if we |
72 // know about the object but the corresponding value is 0, or -1 if the | 74 // know about the object but the corresponding value is 0, or -1 if the |
73 // given object ID isn't in our map. | 75 // given object ID isn't in our map. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // implemented by the Host and Plugin tracker separately, so that it can be | 153 // implemented by the Host and Plugin tracker separately, so that it can be |
152 // a real WebKit ArrayBuffer on the host side. | 154 // a real WebKit ArrayBuffer on the host side. |
153 virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) = 0; | 155 virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) = 0; |
154 | 156 |
155 DISALLOW_COPY_AND_ASSIGN(VarTracker); | 157 DISALLOW_COPY_AND_ASSIGN(VarTracker); |
156 }; | 158 }; |
157 | 159 |
158 } // namespace ppapi | 160 } // namespace ppapi |
159 | 161 |
160 #endif // PPAPI_SHARED_IMPL_VAR_TRACKER_H_ | 162 #endif // PPAPI_SHARED_IMPL_VAR_TRACKER_H_ |
OLD | NEW |