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

Side by Side Diff: mojo/services/html_viewer/webscheduler_impl.cc

Issue 972473004: EXPERIMENTAL, Trying Ross's suggestion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « mojo/services/html_viewer/webscheduler_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // An implementation of WebThread in terms of base::MessageLoop and 5 // An implementation of WebThread in terms of base::MessageLoop and
6 // base::Thread 6 // base::Thread
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/tracked_objects.h" 10 #include "base/tracked_objects.h"
(...skipping 21 matching lines...) Expand all
32 void WebSchedulerImpl::postLoadingTask( 32 void WebSchedulerImpl::postLoadingTask(
33 const blink::WebTraceLocation& web_location, 33 const blink::WebTraceLocation& web_location,
34 blink::WebThread::Task* task) { 34 blink::WebThread::Task* task) {
35 scoped_ptr<blink::WebThread::Task> scoped_task(task); 35 scoped_ptr<blink::WebThread::Task> scoped_task(task);
36 tracked_objects::Location location(web_location.functionName(), 36 tracked_objects::Location location(web_location.functionName(),
37 web_location.fileName(), -1, nullptr); 37 web_location.fileName(), -1, nullptr);
38 task_runner_->PostTask(location, base::Bind(&WebSchedulerImpl::RunTask, 38 task_runner_->PostTask(location, base::Bind(&WebSchedulerImpl::RunTask,
39 base::Passed(&scoped_task))); 39 base::Passed(&scoped_task)));
40 } 40 }
41 41
42 void WebSchedulerImp::postTimerTask(const WebTraceLocation& web_location,
43 blink::WebThread::Task* task,
44 long long delayMs) {
45 scoped_ptr<blink::WebThread::Task> scoped_task(task);
46 tracked_objects::Location location(web_location.functionName(),
47 web_location.fileName(), -1, nullptr);
48 task_runner_->PostDelayedTask(
49 location,
50 base::Bind(&WebSchedulerImpl::RunTask, base::Passed(&scoped_task)),
51 base::TimeDelta::FromMilliseconds(delayMs));
52 }
53
42 void WebSchedulerImpl::shutdown() { 54 void WebSchedulerImpl::shutdown() {
43 task_runner_ = nullptr; 55 task_runner_ = nullptr;
44 } 56 }
45 57
46 // static 58 // static
47 void WebSchedulerImpl::RunIdleTask( 59 void WebSchedulerImpl::RunIdleTask(
48 scoped_ptr<blink::WebScheduler::IdleTask> task) { 60 scoped_ptr<blink::WebScheduler::IdleTask> task) {
49 // TODO(davemoore) Implement idle scheduling. 61 // TODO(davemoore) Implement idle scheduling.
50 task->run(0); 62 task->run(0);
51 } 63 }
52 64
53 // static 65 // static
54 void WebSchedulerImpl::RunTask(scoped_ptr<blink::WebThread::Task> task) { 66 void WebSchedulerImpl::RunTask(scoped_ptr<blink::WebThread::Task> task) {
55 task->run(); 67 task->run();
56 } 68 }
57 69
58 } // namespace html_viewer 70 } // namespace html_viewer
OLDNEW
« no previous file with comments | « mojo/services/html_viewer/webscheduler_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698