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

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

Issue 10542150: Actually free plugin implement vars when running out of process when the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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
« no previous file with comments | « ppapi/shared_impl/test_globals.h ('k') | webkit/plugins/ppapi/host_globals.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"
11 #include "base/hash_tables.h" 11 #include "base/hash_tables.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/threading/non_thread_safe.h" 13 #include "base/threading/non_thread_safe.h"
14 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/c/pp_module.h" 15 #include "ppapi/c/pp_module.h"
15 #include "ppapi/c/pp_var.h" 16 #include "ppapi/c/pp_var.h"
16 #include "ppapi/shared_impl/ppapi_shared_export.h" 17 #include "ppapi/shared_impl/ppapi_shared_export.h"
17 18
18 namespace ppapi { 19 namespace ppapi {
19 20
20 class ArrayBufferVar; 21 class ArrayBufferVar;
21 class Var; 22 class Var;
22 23
23 // Tracks non-POD (refcounted) var objects held by a plugin. 24 // Tracks non-POD (refcounted) var objects held by a plugin.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // 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,
78 // and their reference counts are unaffected. 79 // and their reference counts are unaffected.
79 std::vector<PP_Var> GetLiveVars(); 80 std::vector<PP_Var> GetLiveVars();
80 81
81 // Retrieves the internal reference counts for testing. Returns 0 if we 82 // Retrieves the internal reference counts for testing. Returns 0 if we
82 // 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
83 // given object ID isn't in our map. 84 // given object ID isn't in our map.
84 int GetRefCountForObject(const PP_Var& object); 85 int GetRefCountForObject(const PP_Var& object);
85 int GetTrackedWithNoReferenceCountForObject(const PP_Var& object); 86 int GetTrackedWithNoReferenceCountForObject(const PP_Var& object);
86 87
88 // Called after an instance is deleted to do var cleanup.
89 virtual void DidDeleteInstance(PP_Instance instance) = 0;
90
87 protected: 91 protected:
88 struct VarInfo { 92 struct VarInfo {
89 VarInfo(); 93 VarInfo();
90 VarInfo(Var* v, int input_ref_count); 94 VarInfo(Var* v, int input_ref_count);
91 95
92 scoped_refptr<Var> var; 96 scoped_refptr<Var> var;
93 97
94 // Explicit reference count. This value is affected by the renderer calling 98 // Explicit reference count. This value is affected by the renderer calling
95 // AddRef and Release. A nonzero value here is represented by a single 99 // AddRef and Release. A nonzero value here is represented by a single
96 // reference in the host on our behalf (this reduces IPC traffic). 100 // reference in the host on our behalf (this reduces IPC traffic).
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // 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
162 // a real WebKit ArrayBuffer on the host side. 166 // a real WebKit ArrayBuffer on the host side.
163 virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) = 0; 167 virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) = 0;
164 168
165 DISALLOW_COPY_AND_ASSIGN(VarTracker); 169 DISALLOW_COPY_AND_ASSIGN(VarTracker);
166 }; 170 };
167 171
168 } // namespace ppapi 172 } // namespace ppapi
169 173
170 #endif // PPAPI_SHARED_IMPL_VAR_TRACKER_H_ 174 #endif // PPAPI_SHARED_IMPL_VAR_TRACKER_H_
OLDNEW
« no previous file with comments | « ppapi/shared_impl/test_globals.h ('k') | webkit/plugins/ppapi/host_globals.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698