OLD | NEW |
1 // Copyright (c) 2012 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_PROXY_PLUGIN_VAR_TRACKER_H_ | 5 #ifndef PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_ |
6 #define PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_ | 6 #define PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 PP_Var GetHostObject(const PP_Var& plugin_object) const; | 49 PP_Var GetHostObject(const PP_Var& plugin_object) const; |
50 | 50 |
51 PluginDispatcher* DispatcherForPluginObject( | 51 PluginDispatcher* DispatcherForPluginObject( |
52 const PP_Var& plugin_object) const; | 52 const PP_Var& plugin_object) const; |
53 | 53 |
54 // Like Release() but the var is identified by its host object ID (as | 54 // Like Release() but the var is identified by its host object ID (as |
55 // returned by GetHostObject). | 55 // returned by GetHostObject). |
56 void ReleaseHostObject(PluginDispatcher* dispatcher, | 56 void ReleaseHostObject(PluginDispatcher* dispatcher, |
57 const PP_Var& host_object); | 57 const PP_Var& host_object); |
58 | 58 |
| 59 // Retrieves the internal reference counts for testing. Returns 0 if we |
| 60 // know about the object but the corresponding value is 0, or -1 if the |
| 61 // given object ID isn't in our map. |
| 62 int GetRefCountForObject(const PP_Var& plugin_object); |
| 63 int GetTrackedWithNoReferenceCountForObject(const PP_Var& plugin_object); |
| 64 |
59 private: | 65 private: |
60 // VarTracker protected overrides. | 66 // VarTracker protected overrides. |
61 virtual int32 AddVarInternal(Var* var, AddVarRefMode mode) OVERRIDE; | 67 virtual int32 AddVarInternal(Var* var, AddVarRefMode mode) OVERRIDE; |
62 virtual void TrackedObjectGettingOneRef(VarMap::const_iterator iter) OVERRIDE; | 68 virtual void TrackedObjectGettingOneRef(VarMap::const_iterator iter) OVERRIDE; |
63 virtual void ObjectGettingZeroRef(VarMap::iterator iter) OVERRIDE; | 69 virtual void ObjectGettingZeroRef(VarMap::iterator iter) OVERRIDE; |
64 virtual bool DeleteObjectInfoIfNecessary(VarMap::iterator iter) OVERRIDE; | 70 virtual bool DeleteObjectInfoIfNecessary(VarMap::iterator iter) OVERRIDE; |
65 virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) OVERRIDE; | 71 virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) OVERRIDE; |
66 | 72 |
67 private: | 73 private: |
68 friend struct DefaultSingletonTraits<PluginVarTracker>; | 74 friend struct DefaultSingletonTraits<PluginVarTracker>; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 typedef std::map<HostVar, int32> HostVarToPluginVarMap; | 112 typedef std::map<HostVar, int32> HostVarToPluginVarMap; |
107 HostVarToPluginVarMap host_var_to_plugin_var_; | 113 HostVarToPluginVarMap host_var_to_plugin_var_; |
108 | 114 |
109 DISALLOW_COPY_AND_ASSIGN(PluginVarTracker); | 115 DISALLOW_COPY_AND_ASSIGN(PluginVarTracker); |
110 }; | 116 }; |
111 | 117 |
112 } // namespace proxy | 118 } // namespace proxy |
113 } // namespace ppapi | 119 } // namespace ppapi |
114 | 120 |
115 #endif // PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_ | 121 #endif // PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_ |
OLD | NEW |