OLD | NEW |
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 "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "content/renderer/scheduler/renderer_scheduler.h" | 9 #include "content/renderer/scheduler/renderer_scheduler.h" |
10 #include "third_party/WebKit/public/platform/WebTraceLocation.h" | 10 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 blink::WebScheduler::IdleTask* task) { | 38 blink::WebScheduler::IdleTask* task) { |
39 DCHECK(idle_task_runner_); | 39 DCHECK(idle_task_runner_); |
40 scoped_ptr<blink::WebScheduler::IdleTask> scoped_task(task); | 40 scoped_ptr<blink::WebScheduler::IdleTask> scoped_task(task); |
41 tracked_objects::Location location(web_location.functionName(), | 41 tracked_objects::Location location(web_location.functionName(), |
42 web_location.fileName(), -1, nullptr); | 42 web_location.fileName(), -1, nullptr); |
43 idle_task_runner_->PostIdleTask( | 43 idle_task_runner_->PostIdleTask( |
44 location, | 44 location, |
45 base::Bind(&WebSchedulerImpl::runIdleTask, base::Passed(&scoped_task))); | 45 base::Bind(&WebSchedulerImpl::runIdleTask, base::Passed(&scoped_task))); |
46 } | 46 } |
47 | 47 |
| 48 void WebSchedulerImpl::postIdleTaskAfterWakeup( |
| 49 const blink::WebTraceLocation& web_location, |
| 50 blink::WebScheduler::IdleTask* task) { |
| 51 DCHECK(idle_task_runner_); |
| 52 scoped_ptr<blink::WebScheduler::IdleTask> scoped_task(task); |
| 53 tracked_objects::Location location(web_location.functionName(), |
| 54 web_location.fileName(), -1, nullptr); |
| 55 idle_task_runner_->PostIdleTaskAfterWakeup( |
| 56 location, |
| 57 base::Bind(&WebSchedulerImpl::runIdleTask, base::Passed(&scoped_task))); |
| 58 } |
| 59 |
48 void WebSchedulerImpl::postLoadingTask( | 60 void WebSchedulerImpl::postLoadingTask( |
49 const blink::WebTraceLocation& web_location, blink::WebThread::Task* task) { | 61 const blink::WebTraceLocation& web_location, blink::WebThread::Task* task) { |
50 DCHECK(loading_task_runner_); | 62 DCHECK(loading_task_runner_); |
51 scoped_ptr<blink::WebThread::Task> scoped_task(task); | 63 scoped_ptr<blink::WebThread::Task> scoped_task(task); |
52 tracked_objects::Location location(web_location.functionName(), | 64 tracked_objects::Location location(web_location.functionName(), |
53 web_location.fileName(), -1, nullptr); | 65 web_location.fileName(), -1, nullptr); |
54 loading_task_runner_->PostTask( | 66 loading_task_runner_->PostTask( |
55 location, | 67 location, |
56 base::Bind(&WebSchedulerImpl::runTask, base::Passed(&scoped_task))); | 68 base::Bind(&WebSchedulerImpl::runTask, base::Passed(&scoped_task))); |
57 } | 69 } |
58 | 70 |
59 void WebSchedulerImpl::shutdown() { | 71 void WebSchedulerImpl::shutdown() { |
60 idle_task_runner_ = nullptr; | 72 idle_task_runner_ = nullptr; |
61 loading_task_runner_ = nullptr; | 73 loading_task_runner_ = nullptr; |
62 return renderer_scheduler_->Shutdown(); | 74 return renderer_scheduler_->Shutdown(); |
63 } | 75 } |
64 | 76 |
65 } // namespace content | 77 } // namespace content |
OLD | NEW |