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

Unified Diff: webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc

Issue 9015009: Use the new callback tracker and delete the old one (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 years 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 side-by-side diff with in-line comments
Download patch
Index: webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc
diff --git a/webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc b/webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc
index 139995927746a32f2a914addffe43b82e54df29b..3763b947bb0f9d5b5adf8d39ad4a37601bccf066 100644
--- a/webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc
+++ b/webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc
@@ -12,7 +12,8 @@
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
#include "webkit/plugins/ppapi/resource_helper.h"
-using ::ppapi::thunk::PPB_Flash_NetConnector_API;
+using ppapi::thunk::PPB_Flash_NetConnector_API;
+using ppapi::TrackedCallback;
namespace webkit {
namespace ppapi {
@@ -55,9 +56,7 @@ int32_t PPB_Flash_NetConnector_Impl::ConnectTcp(
int32_t rv = plugin_instance->delegate()->ConnectTcp(this, host, port);
if (rv == PP_OK_COMPLETIONPENDING) {
// Record callback and output buffers.
- callback_ = new TrackedCompletionCallback(
- plugin_instance->module()->GetCallbackTracker(),
- pp_resource(), callback);
+ callback_ = new TrackedCallback(this, callback);
socket_out_ = socket_out;
local_addr_out_ = local_addr_out;
remote_addr_out_ = remote_addr_out;
@@ -90,9 +89,7 @@ int32_t PPB_Flash_NetConnector_Impl::ConnectTcpAddress(
int32_t rv = plugin_instance->delegate()->ConnectTcpAddress(this, addr);
if (rv == PP_OK_COMPLETIONPENDING) {
// Record callback and output buffers.
- callback_ = new TrackedCompletionCallback(
- plugin_instance->module()->GetCallbackTracker(),
- pp_resource(), callback);
+ callback_ = new TrackedCallback(this, callback);
socket_out_ = socket_out;
local_addr_out_ = local_addr_out;
remote_addr_out_ = remote_addr_out;
@@ -124,16 +121,10 @@ void PPB_Flash_NetConnector_Impl::CompleteConnectTcp(
}
}
- // Theoretically, the plugin should be allowed to try another |ConnectTcp()|
- // from the callback.
- scoped_refptr<TrackedCompletionCallback> callback;
- callback.swap(callback_);
- // Wipe everything else out for safety.
socket_out_ = NULL;
local_addr_out_ = NULL;
remote_addr_out_ = NULL;
-
- callback->Run(rv); // Will complete abortively if necessary.
+ TrackedCallback::ClearAndRun(&callback_, rv);
}
} // namespace ppapi

Powered by Google App Engine
This is Rietveld 408576698