| OLD | NEW |
| 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_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 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 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 | 60 // know about the object but the corresponding value is 0, or -1 if the |
| 61 // given object ID isn't in our map. | 61 // given object ID isn't in our map. |
| 62 int GetRefCountForObject(const PP_Var& plugin_object); | 62 int GetRefCountForObject(const PP_Var& plugin_object); |
| 63 int GetTrackedWithNoReferenceCountForObject(const PP_Var& plugin_object); | 63 int GetTrackedWithNoReferenceCountForObject(const PP_Var& plugin_object); |
| 64 | 64 |
| 65 protected: | 65 private: |
| 66 // VarTracker protected overrides. | 66 // VarTracker protected overrides. |
| 67 virtual int32 AddVarInternal(Var* var, AddVarRefMode mode) OVERRIDE; | 67 virtual int32 AddVarInternal(Var* var, AddVarRefMode mode) OVERRIDE; |
| 68 virtual void TrackedObjectGettingOneRef(VarMap::const_iterator iter) OVERRIDE; | 68 virtual void TrackedObjectGettingOneRef(VarMap::const_iterator iter) OVERRIDE; |
| 69 virtual void ObjectGettingZeroRef(VarMap::iterator iter) OVERRIDE; | 69 virtual void ObjectGettingZeroRef(VarMap::iterator iter) OVERRIDE; |
| 70 virtual bool DeleteObjectInfoIfNecessary(VarMap::iterator iter) OVERRIDE; | 70 virtual bool DeleteObjectInfoIfNecessary(VarMap::iterator iter) OVERRIDE; |
| 71 virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) OVERRIDE; |
| 72 |
| 71 | 73 |
| 72 private: | 74 private: |
| 73 friend struct DefaultSingletonTraits<PluginVarTracker>; | 75 friend struct DefaultSingletonTraits<PluginVarTracker>; |
| 74 friend class PluginProxyTestHarness; | 76 friend class PluginProxyTestHarness; |
| 75 | 77 |
| 76 // Represents a var as received from the host. | 78 // Represents a var as received from the host. |
| 77 struct HostVar { | 79 struct HostVar { |
| 78 HostVar(PluginDispatcher* d, int32 i); | 80 HostVar(PluginDispatcher* d, int32 i); |
| 79 | 81 |
| 80 bool operator<(const HostVar& other) const; | 82 bool operator<(const HostVar& other) const; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 111 typedef std::map<HostVar, int32> HostVarToPluginVarMap; | 113 typedef std::map<HostVar, int32> HostVarToPluginVarMap; |
| 112 HostVarToPluginVarMap host_var_to_plugin_var_; | 114 HostVarToPluginVarMap host_var_to_plugin_var_; |
| 113 | 115 |
| 114 DISALLOW_COPY_AND_ASSIGN(PluginVarTracker); | 116 DISALLOW_COPY_AND_ASSIGN(PluginVarTracker); |
| 115 }; | 117 }; |
| 116 | 118 |
| 117 } // namespace proxy | 119 } // namespace proxy |
| 118 } // namespace ppapi | 120 } // namespace ppapi |
| 119 | 121 |
| 120 #endif // PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_ | 122 #endif // PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_ |
| OLD | NEW |