0

Use the same task queue for immediate and delayed tasks

When a task is posted through the WebTestDelegate (used in
LayoutTests), it should go to the same task runner regardless of
whether it is a delayed task or not.

BUG=432129

Review URL: https://codereview.chromium.org/751563002

Cr-Commit-Position: refs/heads/master@{#305216}
This commit is contained in:
skyostil
2014-11-21 06:38:59 -08:00
committed by Commit bot
parent 08118e964c
commit 0fede3fa66

@@ -49,6 +49,7 @@
#include "third_party/WebKit/public/platform/WebRect.h" #include "third_party/WebKit/public/platform/WebRect.h"
#include "third_party/WebKit/public/platform/WebSize.h" #include "third_party/WebKit/public/platform/WebSize.h"
#include "third_party/WebKit/public/platform/WebString.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/WebURL.h"
#include "third_party/WebKit/public/platform/WebURLError.h" #include "third_party/WebKit/public/platform/WebURLError.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h" #include "third_party/WebKit/public/platform/WebURLRequest.h"
@@ -88,6 +89,7 @@ using blink::WebURLError;
using blink::WebURLRequest; using blink::WebURLRequest;
using blink::WebScreenOrientationType; using blink::WebScreenOrientationType;
using blink::WebTestingSupport; using blink::WebTestingSupport;
using blink::WebThread;
using blink::WebVector; using blink::WebVector;
using blink::WebView; using blink::WebView;
@@ -95,11 +97,16 @@ namespace content {
namespace { namespace {
void InvokeTaskHelper(void* context) { class InvokeTaskHelper : public WebThread::Task {
WebTask* task = reinterpret_cast<WebTask*>(context); public:
task->run(); InvokeTaskHelper(scoped_ptr<WebTask> task) : task_(task.Pass()) {}
delete task;
} // WebThread::Task implementation:
void run() override { task_->run(); }
private:
scoped_ptr<WebTask> task_;
};
class SyncNavigationStateVisitor : public RenderViewVisitor { class SyncNavigationStateVisitor : public RenderViewVisitor {
public: public:
@@ -246,14 +253,13 @@ void WebKitTestRunner::PrintMessage(const std::string& message) {
} }
void WebKitTestRunner::PostTask(WebTask* task) { 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) { void WebKitTestRunner::PostDelayedTask(WebTask* task, long long ms) {
base::MessageLoop::current()->PostDelayedTask( Platform::current()->currentThread()->postDelayedTask(
FROM_HERE, new InvokeTaskHelper(make_scoped_ptr(task)), ms);
base::Bind(&WebTask::run, base::Owned(task)),
base::TimeDelta::FromMilliseconds(ms));
} }
WebString WebKitTestRunner::RegisterIsolatedFileSystem( WebString WebKitTestRunner::RegisterIsolatedFileSystem(