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

Side by Side Diff: content/renderer/scheduler/web_scheduler_impl.cc

Issue 854053003: Adds support for loading tasks in WebSchedulerImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a #include Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « content/renderer/scheduler/web_scheduler_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/scheduler/web_scheduler_impl.h" 5 #include "content/renderer/scheduler/web_scheduler_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/renderer/scheduler/renderer_scheduler.h" 8 #include "content/renderer/scheduler/renderer_scheduler.h"
9 #include "third_party/WebKit/public/platform/WebTraceLocation.h" 9 #include "third_party/WebKit/public/platform/WebTraceLocation.h"
10 10
(...skipping 10 matching lines...) Expand all
21 bool WebSchedulerImpl::shouldYieldForHighPriorityWork() { 21 bool WebSchedulerImpl::shouldYieldForHighPriorityWork() {
22 return renderer_scheduler_->ShouldYieldForHighPriorityWork(); 22 return renderer_scheduler_->ShouldYieldForHighPriorityWork();
23 } 23 }
24 24
25 void WebSchedulerImpl::runIdleTask( 25 void WebSchedulerImpl::runIdleTask(
26 scoped_ptr<blink::WebScheduler::IdleTask> task, 26 scoped_ptr<blink::WebScheduler::IdleTask> task,
27 base::TimeTicks deadline) { 27 base::TimeTicks deadline) {
28 task->run((deadline - base::TimeTicks()).InSecondsF()); 28 task->run((deadline - base::TimeTicks()).InSecondsF());
29 } 29 }
30 30
31 void WebSchedulerImpl::runTask(scoped_ptr<blink::WebThread::Task> task) {
32 task->run();
33 }
34
31 void WebSchedulerImpl::postIdleTask(const blink::WebTraceLocation& web_location, 35 void WebSchedulerImpl::postIdleTask(const blink::WebTraceLocation& web_location,
32 blink::WebScheduler::IdleTask* task) { 36 blink::WebScheduler::IdleTask* task) {
33 scoped_ptr<blink::WebScheduler::IdleTask> scoped_task(task); 37 scoped_ptr<blink::WebScheduler::IdleTask> scoped_task(task);
34 tracked_objects::Location location(web_location.functionName(), 38 tracked_objects::Location location(web_location.functionName(),
35 web_location.fileName(), -1, nullptr); 39 web_location.fileName(), -1, nullptr);
36 idle_task_runner_->PostIdleTask( 40 idle_task_runner_->PostIdleTask(
37 location, 41 location,
38 base::Bind(&WebSchedulerImpl::runIdleTask, base::Passed(&scoped_task))); 42 base::Bind(&WebSchedulerImpl::runIdleTask, base::Passed(&scoped_task)));
39 } 43 }
40 44
45 void WebSchedulerImpl::postLoadingTask(
46 const blink::WebTraceLocation& web_location, blink::WebThread::Task* task) {
47 scoped_ptr<blink::WebThread::Task> scoped_task(task);
48 tracked_objects::Location location(web_location.functionName(),
49 web_location.fileName(), -1, nullptr);
50 renderer_scheduler_->LoadingTaskRunner()->PostTask(
51 location,
52 base::Bind(&WebSchedulerImpl::runTask, base::Passed(&scoped_task)));
53 }
54
41 void WebSchedulerImpl::shutdown() { 55 void WebSchedulerImpl::shutdown() {
42 return renderer_scheduler_->Shutdown(); 56 return renderer_scheduler_->Shutdown();
43 } 57 }
44 58
45 } // namespace content 59 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/scheduler/web_scheduler_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698