Revert 106717 - Revert 106677 (caused several PPAPI test timeouts, see http://crbug.com/101154)
- Remove the proxy callback tracker.

This doesn't properly delete callbacks when the corresponding resource goes
away. This can lead to leaks or crashes in the plugin when the callback is
triggered unexpectedly.

BUG=http://crbug.com/86279

Review URL: http://codereview.chromium.org/8226009

[email protected]
Review URL: http://codereview.chromium.org/8364040

[email protected]
Review URL: http://codereview.chromium.org/8371008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106764 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ppapi/proxy/plugin_dispatcher.cc b/ppapi/proxy/plugin_dispatcher.cc
index dba5253f..3da15e9 100644
--- a/ppapi/proxy/plugin_dispatcher.cc
+++ b/ppapi/proxy/plugin_dispatcher.cc
@@ -42,10 +42,18 @@
 }  // namespace
 
 InstanceData::InstanceData()
-    : fullscreen(PP_FALSE), flash_fullscreen(PP_FALSE) {
+    : fullscreen(PP_FALSE),
+      flash_fullscreen(PP_FALSE),
+      mouse_lock_callback(PP_BlockUntilComplete()) {
   memset(&position, 0, sizeof(position));
 }
 
+InstanceData::~InstanceData() {
+  // Run any pending mouse lock callback to prevent leaks.
+  if (mouse_lock_callback.func)
+    PP_RunAndClearCompletionCallback(&mouse_lock_callback, PP_ERROR_ABORTED);
+}
+
 PluginDispatcher::PluginDispatcher(base::ProcessHandle remote_process_handle,
                                    GetInterfaceFunc get_interface)
     : Dispatcher(remote_process_handle, get_interface),