| 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_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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // Like Release() but the var is identified by its host object ID (as | 56 // Like Release() but the var is identified by its host object ID (as |
| 57 // returned by GetHostObject). | 57 // returned by GetHostObject). |
| 58 void ReleaseHostObject(PluginDispatcher* dispatcher, | 58 void ReleaseHostObject(PluginDispatcher* dispatcher, |
| 59 const PP_Var& host_object); | 59 const PP_Var& host_object); |
| 60 | 60 |
| 61 // VarTracker public overrides. | 61 // VarTracker public overrides. |
| 62 virtual PP_Var MakeResourcePPVarFromMessage( | 62 virtual PP_Var MakeResourcePPVarFromMessage( |
| 63 PP_Instance instance, | 63 PP_Instance instance, |
| 64 const IPC::Message& creation_message, | 64 const IPC::Message& creation_message, |
| 65 int pending_renderer_id, | 65 int pending_renderer_id, |
| 66 int pending_browser_id) OVERRIDE; | 66 int pending_browser_id) override; |
| 67 virtual ResourceVar* MakeResourceVar(PP_Resource pp_resource) OVERRIDE; | 67 virtual ResourceVar* MakeResourceVar(PP_Resource pp_resource) override; |
| 68 virtual void DidDeleteInstance(PP_Instance instance) OVERRIDE; | 68 virtual void DidDeleteInstance(PP_Instance instance) override; |
| 69 virtual int TrackSharedMemoryHandle(PP_Instance instance, | 69 virtual int TrackSharedMemoryHandle(PP_Instance instance, |
| 70 base::SharedMemoryHandle file, | 70 base::SharedMemoryHandle file, |
| 71 uint32 size_in_bytes) OVERRIDE; | 71 uint32 size_in_bytes) override; |
| 72 virtual bool StopTrackingSharedMemoryHandle(int id, | 72 virtual bool StopTrackingSharedMemoryHandle(int id, |
| 73 PP_Instance instance, | 73 PP_Instance instance, |
| 74 base::SharedMemoryHandle* handle, | 74 base::SharedMemoryHandle* handle, |
| 75 uint32* size_in_bytes) OVERRIDE; | 75 uint32* size_in_bytes) override; |
| 76 | 76 |
| 77 // Notification that a plugin-implemented object (PPP_Class) was created by | 77 // Notification that a plugin-implemented object (PPP_Class) was created by |
| 78 // the plugin or deallocated by WebKit over IPC. | 78 // the plugin or deallocated by WebKit over IPC. |
| 79 void PluginImplementedObjectCreated(PP_Instance instance, | 79 void PluginImplementedObjectCreated(PP_Instance instance, |
| 80 const PP_Var& created_var, | 80 const PP_Var& created_var, |
| 81 const PPP_Class_Deprecated* ppp_class, | 81 const PPP_Class_Deprecated* ppp_class, |
| 82 void* ppp_class_data); | 82 void* ppp_class_data); |
| 83 void PluginImplementedObjectDestroyed(void* ppp_class_data); | 83 void PluginImplementedObjectDestroyed(void* ppp_class_data); |
| 84 | 84 |
| 85 // Returns true if there is an object implemented by the plugin with the | 85 // Returns true if there is an object implemented by the plugin with the |
| 86 // given user_data that has not been deallocated yet. Call this when | 86 // given user_data that has not been deallocated yet. Call this when |
| 87 // receiving a scripting call to the plugin to validate that the object | 87 // receiving a scripting call to the plugin to validate that the object |
| 88 // receiving the call is still alive (see user_data_to_plugin_ below). | 88 // receiving the call is still alive (see user_data_to_plugin_ below). |
| 89 bool IsPluginImplementedObjectAlive(void* user_data); | 89 bool IsPluginImplementedObjectAlive(void* user_data); |
| 90 | 90 |
| 91 // Validates that the given class/user_data pair corresponds to a currently | 91 // Validates that the given class/user_data pair corresponds to a currently |
| 92 // living plugin object. | 92 // living plugin object. |
| 93 bool ValidatePluginObjectCall(const PPP_Class_Deprecated* ppp_class, | 93 bool ValidatePluginObjectCall(const PPP_Class_Deprecated* ppp_class, |
| 94 void* user_data); | 94 void* user_data); |
| 95 | 95 |
| 96 void DidDeleteDispatcher(PluginDispatcher* dispatcher); | 96 void DidDeleteDispatcher(PluginDispatcher* dispatcher); |
| 97 | 97 |
| 98 private: | 98 private: |
| 99 // VarTracker protected overrides. | 99 // VarTracker protected overrides. |
| 100 virtual int32 AddVarInternal(Var* var, AddVarRefMode mode) OVERRIDE; | 100 virtual int32 AddVarInternal(Var* var, AddVarRefMode mode) override; |
| 101 virtual void TrackedObjectGettingOneRef(VarMap::const_iterator iter) OVERRIDE; | 101 virtual void TrackedObjectGettingOneRef(VarMap::const_iterator iter) override; |
| 102 virtual void ObjectGettingZeroRef(VarMap::iterator iter) OVERRIDE; | 102 virtual void ObjectGettingZeroRef(VarMap::iterator iter) override; |
| 103 virtual bool DeleteObjectInfoIfNecessary(VarMap::iterator iter) OVERRIDE; | 103 virtual bool DeleteObjectInfoIfNecessary(VarMap::iterator iter) override; |
| 104 virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) OVERRIDE; | 104 virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) override; |
| 105 virtual ArrayBufferVar* CreateShmArrayBuffer( | 105 virtual ArrayBufferVar* CreateShmArrayBuffer( |
| 106 uint32 size_in_bytes, | 106 uint32 size_in_bytes, |
| 107 base::SharedMemoryHandle handle) OVERRIDE; | 107 base::SharedMemoryHandle handle) override; |
| 108 | 108 |
| 109 private: | 109 private: |
| 110 friend struct DefaultSingletonTraits<PluginVarTracker>; | 110 friend struct DefaultSingletonTraits<PluginVarTracker>; |
| 111 friend class PluginProxyTestHarness; | 111 friend class PluginProxyTestHarness; |
| 112 | 112 |
| 113 // Represents a var as received from the host. | 113 // Represents a var as received from the host. |
| 114 struct HostVar { | 114 struct HostVar { |
| 115 HostVar(PluginDispatcher* d, int32 i); | 115 HostVar(PluginDispatcher* d, int32 i); |
| 116 | 116 |
| 117 bool operator<(const HostVar& other) const; | 117 bool operator<(const HostVar& other) const; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 UserDataToPluginImplementedVarMap; | 202 UserDataToPluginImplementedVarMap; |
| 203 UserDataToPluginImplementedVarMap user_data_to_plugin_; | 203 UserDataToPluginImplementedVarMap user_data_to_plugin_; |
| 204 | 204 |
| 205 DISALLOW_COPY_AND_ASSIGN(PluginVarTracker); | 205 DISALLOW_COPY_AND_ASSIGN(PluginVarTracker); |
| 206 }; | 206 }; |
| 207 | 207 |
| 208 } // namespace proxy | 208 } // namespace proxy |
| 209 } // namespace ppapi | 209 } // namespace ppapi |
| 210 | 210 |
| 211 #endif // PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_ | 211 #endif // PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_ |
| OLD | NEW |