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

Unified Diff: webkit/tools/test_shell/layout_test_controller.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
« no previous file with comments | « webkit/tools/test_shell/layout_test_controller.h ('k') | webkit/tools/test_shell/mac/webwidget_host.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/test_shell/layout_test_controller.cc
diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc
index 4b3fda137a085d05183e2f344e0d514b6bbac870..c295aefde1889d3558191f00273a344f2489ba31 100644
--- a/webkit/tools/test_shell/layout_test_controller.cc
+++ b/webkit/tools/test_shell/layout_test_controller.cc
@@ -10,6 +10,7 @@
#include "base/base64.h"
#include "base/basictypes.h"
+#include "base/bind.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
@@ -69,7 +70,7 @@ bool LayoutTestController::stop_provisional_frame_loads_ = false;
LayoutTestController::WorkQueue LayoutTestController::work_queue_;
LayoutTestController::LayoutTestController(TestShell* shell) :
- ALLOW_THIS_IN_INITIALIZER_LIST(timeout_factory_(this)) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
// Set static shell_ variable since we can't do it in an initializer list.
// We also need to be careful not to assign shell_ to new windows which are
// temporary.
@@ -151,9 +152,10 @@ void LayoutTestController::waitUntilDone(
if (!is_debugger_present) {
// TODO(ojan): Use base::OneShotTimer. For some reason, using OneShotTimer
// seems to cause layout test failures on the try bots.
- MessageLoop::current()->PostDelayedTask(FROM_HERE,
- timeout_factory_.NewRunnableMethod(
- &LayoutTestController::notifyDoneTimedOut),
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&LayoutTestController::notifyDoneTimedOut,
+ weak_factory_.GetWeakPtr()),
shell_->GetLayoutTestTimeout());
}
@@ -164,7 +166,7 @@ void LayoutTestController::waitUntilDone(
void LayoutTestController::notifyDone(
const CppArgumentList& args, CppVariant* result) {
// Test didn't timeout. Kill the timeout timer.
- timeout_factory_.RevokeAll();
+ weak_factory_.InvalidateWeakPtrs();
completeNotifyDone(false);
result->SetNull();
« no previous file with comments | « webkit/tools/test_shell/layout_test_controller.h ('k') | webkit/tools/test_shell/mac/webwidget_host.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698