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

Side by Side Diff: components/html_viewer/web_scheduler_impl.cc

Issue 1106213002: Adds a SHUTDOWN_TASK_QUEUE and a PreShutdown api to the scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments. Created 5 years, 7 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
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 28 matching lines...) Expand all
39 base::Passed(&scoped_task))); 39 base::Passed(&scoped_task)));
40 } 40 }
41 41
42 void WebSchedulerImpl::postTimerTask( 42 void WebSchedulerImpl::postTimerTask(
43 const blink::WebTraceLocation& web_location, 43 const blink::WebTraceLocation& web_location,
44 blink::WebThread::Task* task, 44 blink::WebThread::Task* task,
45 long long delayMs) { 45 long long delayMs) {
46 scoped_ptr<blink::WebThread::Task> scoped_task(task); 46 scoped_ptr<blink::WebThread::Task> scoped_task(task);
47 tracked_objects::Location location(web_location.functionName(), 47 tracked_objects::Location location(web_location.functionName(),
48 web_location.fileName(), -1, nullptr); 48 web_location.fileName(), -1, nullptr);
49 task_runner_->PostDelayedTask( 49 task_runner_->PostNonNestableDelayedTask(
50 location, 50 location,
51 base::Bind(&WebSchedulerImpl::RunTask, base::Passed(&scoped_task)), 51 base::Bind(&WebSchedulerImpl::RunTask, base::Passed(&scoped_task)),
52 base::TimeDelta::FromMilliseconds(delayMs)); 52 base::TimeDelta::FromMilliseconds(delayMs));
53 } 53 }
54 54
55 void WebSchedulerImpl::postShutdownTask(
56 const blink::WebTraceLocation& web_location,
57 blink::WebThread::Task* task,
58 long long delayMs) {
59 scoped_ptr<blink::WebThread::Task> scoped_task(task);
60 tracked_objects::Location location(web_location.functionName(),
61 web_location.fileName(), -1, nullptr);
62 task_runner_->PostNonNestableDelayedTask(
63 location,
64 base::Bind(&WebSchedulerImpl::RunTask, base::Passed(&scoped_task)),
65 base::TimeDelta::FromMilliseconds(delayMs));
66 }
67
68 void WebSchedulerImpl::preShutdown() {
69 // TODO(alexclarke) Implement pre shutdown for mojo?
70 NOTIMPLEMENTED();
71 }
72
55 // static 73 // static
56 void WebSchedulerImpl::RunIdleTask( 74 void WebSchedulerImpl::RunIdleTask(
57 scoped_ptr<blink::WebThread::IdleTask> task) { 75 scoped_ptr<blink::WebThread::IdleTask> task) {
58 // TODO(davemoore) Implement idle scheduling. 76 // TODO(davemoore) Implement idle scheduling.
59 task->run(0); 77 task->run(0);
60 } 78 }
61 79
62 // static 80 // static
63 void WebSchedulerImpl::RunTask(scoped_ptr<blink::WebThread::Task> task) { 81 void WebSchedulerImpl::RunTask(scoped_ptr<blink::WebThread::Task> task) {
64 task->run(); 82 task->run();
65 } 83 }
66 84
67 } // namespace html_viewer 85 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/html_viewer/web_scheduler_impl.h ('k') | components/scheduler/child/child_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698