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

Side by Side Diff: components/scheduler/child/webthread_impl_for_worker_scheduler.cc

Issue 1449953002: compositor-worker: Refactor CompositorWorkerManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address reviewer comments. Created 5 years 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 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" 5 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
11 #include "base/time/default_tick_clock.h" 11 #include "base/time/default_tick_clock.h"
12 #include "components/scheduler/base/task_queue.h" 12 #include "components/scheduler/base/task_queue.h"
13 #include "components/scheduler/child/scheduler_tqm_delegate_impl.h" 13 #include "components/scheduler/child/scheduler_tqm_delegate_impl.h"
14 #include "components/scheduler/child/web_scheduler_impl.h" 14 #include "components/scheduler/child/web_scheduler_impl.h"
15 #include "components/scheduler/child/web_task_runner_impl.h" 15 #include "components/scheduler/child/web_task_runner_impl.h"
16 #include "components/scheduler/child/worker_scheduler_impl.h" 16 #include "components/scheduler/child/worker_scheduler_impl.h"
17 #include "third_party/WebKit/public/platform/WebTraceLocation.h" 17 #include "third_party/WebKit/public/platform/WebTraceLocation.h"
18 18
19 namespace scheduler { 19 namespace scheduler {
20 20
21 WebThreadImplForWorkerScheduler::WebThreadImplForWorkerScheduler( 21 WebThreadImplForWorkerScheduler::WebThreadImplForWorkerScheduler(
22 const char* name) 22 const char* name)
23 : thread_(new base::Thread(name)) { 23 : WebThreadImplForWorkerScheduler(name, base::Thread::Options()) {}
24 thread_->Start(); 24
25 WebThreadImplForWorkerScheduler::WebThreadImplForWorkerScheduler(
26 const char* name,
27 base::Thread::Options options)
28 : thread_(new base::Thread(name ? name : "")) {
piman 2015/11/30 21:41:45 nit: std::string() instead of "" to avoid a needle
Ian Vollick 2015/12/01 04:00:03 Done.
29 thread_->StartWithOptions(options);
25 thread_task_runner_ = thread_->task_runner(); 30 thread_task_runner_ = thread_->task_runner();
26 31
27 base::WaitableEvent completion(false, false); 32 base::WaitableEvent completion(false, false);
28 thread_task_runner_->PostTask( 33 thread_task_runner_->PostTask(
29 FROM_HERE, base::Bind(&WebThreadImplForWorkerScheduler::InitOnThread, 34 FROM_HERE, base::Bind(&WebThreadImplForWorkerScheduler::InitOnThread,
30 base::Unretained(this), &completion)); 35 base::Unretained(this), &completion));
31 completion.Wait(); 36 completion.Wait();
32 } 37 }
33 38
34 WebThreadImplForWorkerScheduler::~WebThreadImplForWorkerScheduler() { 39 WebThreadImplForWorkerScheduler::~WebThreadImplForWorkerScheduler() {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 base::MessageLoop::TaskObserver* observer) { 105 base::MessageLoop::TaskObserver* observer) {
101 worker_scheduler_->AddTaskObserver(observer); 106 worker_scheduler_->AddTaskObserver(observer);
102 } 107 }
103 108
104 void WebThreadImplForWorkerScheduler::RemoveTaskObserverInternal( 109 void WebThreadImplForWorkerScheduler::RemoveTaskObserverInternal(
105 base::MessageLoop::TaskObserver* observer) { 110 base::MessageLoop::TaskObserver* observer) {
106 worker_scheduler_->RemoveTaskObserver(observer); 111 worker_scheduler_->RemoveTaskObserver(observer);
107 } 112 }
108 113
109 } // namespace scheduler 114 } // namespace scheduler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698