Commit 4aa3fa76 authored by alexclarke's avatar alexclarke Committed by Commit bot

Chromium side of adding postLoading task to the blink scheduler.

BUG=391005

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

Cr-Commit-Position: refs/heads/master@{#313087}
parent 1d4c7f2b
......@@ -28,6 +28,10 @@ void WebSchedulerImpl::runIdleTask(
task->run((deadline - base::TimeTicks()).InSecondsF());
}
void WebSchedulerImpl::runTask(scoped_ptr<blink::WebThread::Task> task) {
task->run();
}
void WebSchedulerImpl::postIdleTask(const blink::WebTraceLocation& web_location,
blink::WebScheduler::IdleTask* task) {
scoped_ptr<blink::WebScheduler::IdleTask> scoped_task(task);
......@@ -38,6 +42,16 @@ void WebSchedulerImpl::postIdleTask(const blink::WebTraceLocation& web_location,
base::Bind(&WebSchedulerImpl::runIdleTask, base::Passed(&scoped_task)));
}
void WebSchedulerImpl::postLoadingTask(
const blink::WebTraceLocation& web_location, blink::WebThread::Task* task) {
scoped_ptr<blink::WebThread::Task> scoped_task(task);
tracked_objects::Location location(web_location.functionName(),
web_location.fileName(), -1, nullptr);
renderer_scheduler_->LoadingTaskRunner()->PostTask(
location,
base::Bind(&WebSchedulerImpl::runTask, base::Passed(&scoped_task)));
}
void WebSchedulerImpl::shutdown() {
return renderer_scheduler_->Shutdown();
}
......
......@@ -9,6 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "third_party/WebKit/public/platform/WebScheduler.h"
#include "third_party/WebKit/public/platform/WebThread.h"
namespace content {
......@@ -23,11 +24,14 @@ class WebSchedulerImpl : public blink::WebScheduler {
virtual bool shouldYieldForHighPriorityWork();
virtual void postIdleTask(const blink::WebTraceLocation& location,
blink::WebScheduler::IdleTask* task);
virtual void postLoadingTask(const blink::WebTraceLocation& location,
blink::WebThread::Task* task);
virtual void shutdown();
private:
static void runIdleTask(scoped_ptr<blink::WebScheduler::IdleTask> task,
base::TimeTicks deadline);
static void runTask(scoped_ptr<blink::WebThread::Task> task);
RendererScheduler* renderer_scheduler_;
scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment