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/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(