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

Side by Side Diff: cc/base/worker_pool.cc

Issue 13206004: cc: Fix build issues for adding ‘chromium_code’: 1 to cc.gyp and cc_tests.gyp (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/base/worker_pool.h" 5 #include "cc/base/worker_pool.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 184 }
185 185
186 WorkerPool::Inner::~Inner() { 186 WorkerPool::Inner::~Inner() {
187 base::AutoLock lock(lock_); 187 base::AutoLock lock(lock_);
188 188
189 DCHECK(shutdown_); 189 DCHECK(shutdown_);
190 190
191 // Cancel all pending callbacks. 191 // Cancel all pending callbacks.
192 weak_ptr_factory_.InvalidateWeakPtrs(); 192 weak_ptr_factory_.InvalidateWeakPtrs();
193 193
194 DCHECK_EQ(pending_tasks_.size(), 0); 194 DCHECK(pending_tasks_.empty());
jamesr 2013/03/29 00:07:16 one slight bummer about this change is if the DCHE
danakj 2013/03/29 00:17:35 True.. okay I'll switch all these to == 0
195 DCHECK_EQ(completed_tasks_.size(), 0); 195 DCHECK(completed_tasks_.empty());
196 DCHECK_EQ(running_task_count_, 0); 196 DCHECK_EQ(running_task_count_, 0u);
197 } 197 }
198 198
199 void WorkerPool::Inner::Shutdown() { 199 void WorkerPool::Inner::Shutdown() {
200 { 200 {
201 base::AutoLock lock(lock_); 201 base::AutoLock lock(lock_);
202 202
203 DCHECK(!shutdown_); 203 DCHECK(!shutdown_);
204 shutdown_ = true; 204 shutdown_ = true;
205 205
206 // Wake up a worker so it knows it should exit. This will cause all workers 206 // Wake up a worker so it knows it should exit. This will cause all workers
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 // for completed tasks delay is 0. 423 // for completed tasks delay is 0.
424 check_for_completed_tasks_delay == base::TimeDelta()))) { 424 check_for_completed_tasks_delay == base::TimeDelta()))) {
425 } 425 }
426 426
427 WorkerPool::~WorkerPool() { 427 WorkerPool::~WorkerPool() {
428 Shutdown(); 428 Shutdown();
429 429
430 // Cancel all pending callbacks. 430 // Cancel all pending callbacks.
431 weak_ptr_factory_.InvalidateWeakPtrs(); 431 weak_ptr_factory_.InvalidateWeakPtrs();
432 432
433 DCHECK_EQ(completed_tasks_.size(), 0); 433 DCHECK(completed_tasks_.empty());
jamesr 2013/03/29 00:07:16 ditto
434 } 434 }
435 435
436 void WorkerPool::Shutdown() { 436 void WorkerPool::Shutdown() {
437 inner_->Shutdown(); 437 inner_->Shutdown();
438 DispatchCompletionCallbacks(); 438 DispatchCompletionCallbacks();
439 } 439 }
440 440
441 void WorkerPool::PostTaskAndReply( 441 void WorkerPool::PostTaskAndReply(
442 const Callback& task, const base::Closure& reply) { 442 const Callback& task, const base::Closure& reply) {
443 PostTask(make_scoped_ptr(new WorkerPoolTaskImpl( 443 PostTask(make_scoped_ptr(new WorkerPoolTaskImpl(
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 TRACE_EVENT_SCOPE_THREAD); 564 TRACE_EVENT_SCOPE_THREAD);
565 CancelCheckForCompletedTasks(); 565 CancelCheckForCompletedTasks();
566 DispatchCompletionCallbacks(); 566 DispatchCompletionCallbacks();
567 // Schedule another check for completed tasks if not idle. 567 // Schedule another check for completed tasks if not idle.
568 if (!is_idle) 568 if (!is_idle)
569 ScheduleCheckForCompletedTasks(); 569 ScheduleCheckForCompletedTasks();
570 } 570 }
571 } 571 }
572 572
573 } // namespace cc 573 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698