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

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

Issue 9034035: Make it possible to have 1 PpapiGlobals per thread. Update unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test. Cleanup. Move proxy lock to globals. Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 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 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 64
65 // Return a vector containing all PP_Vars that are in the tracker. This is 65 // 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 66 // 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, 67 // used in production code. The PP_Vars are returned in no particular order,
68 // and their reference counts are unaffected. 68 // and their reference counts are unaffected.
69 std::vector<PP_Var> GetLiveVars(); 69 std::vector<PP_Var> GetLiveVars();
70 70
71 // 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
73 // given object ID isn't in our map.
74 int GetRefCountForObject(const PP_Var& object);
75 int GetTrackedWithNoReferenceCountForObject(const PP_Var& object);
76
71 protected: 77 protected:
72 struct VarInfo { 78 struct VarInfo {
73 VarInfo(); 79 VarInfo();
74 VarInfo(Var* v, int input_ref_count); 80 VarInfo(Var* v, int input_ref_count);
75 81
76 scoped_refptr<Var> var; 82 scoped_refptr<Var> var;
77 83
78 // Explicit reference count. This value is affected by the renderer calling 84 // Explicit reference count. This value is affected by the renderer calling
79 // AddRef and Release. A nonzero value here is represented by a single 85 // AddRef and Release. A nonzero value here is represented by a single
80 // reference in the host on our behalf (this reduces IPC traffic). 86 // reference in the host on our behalf (this reduces IPC traffic).
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // implemented by the Host and Plugin tracker separately, so that it can be 151 // implemented by the Host and Plugin tracker separately, so that it can be
146 // a real WebKit ArrayBuffer on the host side. 152 // a real WebKit ArrayBuffer on the host side.
147 virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) = 0; 153 virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) = 0;
148 154
149 DISALLOW_COPY_AND_ASSIGN(VarTracker); 155 DISALLOW_COPY_AND_ASSIGN(VarTracker);
150 }; 156 };
151 157
152 } // namespace ppapi 158 } // namespace ppapi
153 159
154 #endif // PPAPI_SHARED_IMPL_VAR_TRACKER_H_ 160 #endif // PPAPI_SHARED_IMPL_VAR_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698