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

Unified Diff: content/shell/renderer/layout_test/webkit_test_runner.cc

Issue 751563002: Use the same task queue for immediate and delayed tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/renderer/layout_test/webkit_test_runner.cc
diff --git a/content/shell/renderer/layout_test/webkit_test_runner.cc b/content/shell/renderer/layout_test/webkit_test_runner.cc
index 0bda738056669bf608b6412106b20fa9c36ed6b0..b030c97a74536028c24e5d00cac4063f2f521956 100644
--- a/content/shell/renderer/layout_test/webkit_test_runner.cc
+++ b/content/shell/renderer/layout_test/webkit_test_runner.cc
@@ -49,6 +49,7 @@
#include "third_party/WebKit/public/platform/WebRect.h"
#include "third_party/WebKit/public/platform/WebSize.h"
#include "third_party/WebKit/public/platform/WebString.h"
+#include "third_party/WebKit/public/platform/WebThread.h"
#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/platform/WebURLError.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h"
@@ -88,6 +89,7 @@ using blink::WebURLError;
using blink::WebURLRequest;
using blink::WebScreenOrientationType;
using blink::WebTestingSupport;
+using blink::WebThread;
using blink::WebVector;
using blink::WebView;
@@ -95,11 +97,16 @@ namespace content {
namespace {
-void InvokeTaskHelper(void* context) {
- WebTask* task = reinterpret_cast<WebTask*>(context);
- task->run();
- delete task;
-}
+class InvokeTaskHelper : public WebThread::Task {
+ public:
+ InvokeTaskHelper(scoped_ptr<WebTask> task) : task_(task.Pass()) {}
+
+ // WebThread::Task implementation:
+ void run() override { task_->run(); }
+
+ private:
+ scoped_ptr<WebTask> task_;
+};
class SyncNavigationStateVisitor : public RenderViewVisitor {
public:
@@ -246,14 +253,13 @@ void WebKitTestRunner::PrintMessage(const std::string& message) {
}
void WebKitTestRunner::PostTask(WebTask* task) {
- Platform::current()->callOnMainThread(InvokeTaskHelper, task);
+ Platform::current()->currentThread()->postTask(
+ new InvokeTaskHelper(make_scoped_ptr(task)));
}
void WebKitTestRunner::PostDelayedTask(WebTask* task, long long ms) {
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&WebTask::run, base::Owned(task)),
- base::TimeDelta::FromMilliseconds(ms));
+ Platform::current()->currentThread()->postDelayedTask(
+ new InvokeTaskHelper(make_scoped_ptr(task)), ms);
}
WebString WebKitTestRunner::RegisterIsolatedFileSystem(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698