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

Unified Diff: webkit/tools/test_shell/test_shell_devtools_client.cc

Issue 8215002: base::Bind: Cleanup in test_shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix. Created 9 years, 2 months 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/tools/test_shell/test_shell_devtools_client.cc
diff --git a/webkit/tools/test_shell/test_shell_devtools_client.cc b/webkit/tools/test_shell/test_shell_devtools_client.cc
index 320e7e21b3328cf27de65a4b29bb8bf49c1b5aec..b8d5664ea6bb581882376c0e666e2fb239047bb5 100644
--- a/webkit/tools/test_shell/test_shell_devtools_client.cc
+++ b/webkit/tools/test_shell/test_shell_devtools_client.cc
@@ -14,6 +14,7 @@
#include "webkit/tools/test_shell/test_shell_devtools_callargs.h"
#include "webkit/tools/test_shell/test_shell_devtools_client.h"
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/message_loop.h"
@@ -25,7 +26,7 @@ using WebKit::WebView;
TestShellDevToolsClient::TestShellDevToolsClient(TestShellDevToolsAgent *agent,
WebView* web_view)
- : ALLOW_THIS_IN_INITIALIZER_LIST(call_method_factory_(this)),
+ : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
dev_tools_agent_(agent),
web_view_(web_view) {
web_tools_frontend_.reset(WebDevToolsFrontend::create(web_view_, this,
@@ -36,7 +37,7 @@ TestShellDevToolsClient::TestShellDevToolsClient(TestShellDevToolsAgent *agent,
TestShellDevToolsClient::~TestShellDevToolsClient() {
// It is a chance that page will be destroyed at detach step of
// dev_tools_agent_ and we should clean pending requests a bit earlier.
- call_method_factory_.RevokeAll();
+ weak_factory_.InvalidateWeakPtrs();
if (dev_tools_agent_)
dev_tools_agent_->detach();
}
@@ -74,9 +75,10 @@ void TestShellDevToolsClient::undockWindow() {
}
void TestShellDevToolsClient::AsyncCall(const TestShellDevToolsCallArgs &args) {
- MessageLoop::current()->PostDelayedTask(FROM_HERE,
- call_method_factory_.NewRunnableMethod(&TestShellDevToolsClient::Call,
- args), 0);
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&TestShellDevToolsClient::Call, weak_factory_.GetWeakPtr(),
+ args));
}
void TestShellDevToolsClient::Call(const TestShellDevToolsCallArgs &args) {
« no previous file with comments | « webkit/tools/test_shell/test_shell_devtools_client.h ('k') | webkit/tools/test_shell/test_webview_delegate_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698