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

Side by Side Diff: base/threading/sequenced_worker_pool.cc

Issue 133313005: Revert of Make flow event traces disabled-by-default, and rename "ipc" and "task" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
« no previous file with comments | « base/message_loop/message_pump_gtk.cc ('k') | base/threading/worker_pool_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/threading/sequenced_worker_pool.h" 5 #include "base/threading/sequenced_worker_pool.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 if (max_blocking_tasks_after_shutdown_ <= 0) { 586 if (max_blocking_tasks_after_shutdown_ <= 0) {
587 DLOG(WARNING) << "BLOCK_SHUTDOWN task disallowed"; 587 DLOG(WARNING) << "BLOCK_SHUTDOWN task disallowed";
588 return false; 588 return false;
589 } 589 }
590 max_blocking_tasks_after_shutdown_ -= 1; 590 max_blocking_tasks_after_shutdown_ -= 1;
591 } 591 }
592 592
593 // The trace_id is used for identifying the task in about:tracing. 593 // The trace_id is used for identifying the task in about:tracing.
594 sequenced.trace_id = trace_id_++; 594 sequenced.trace_id = trace_id_++;
595 595
596 TRACE_EVENT_FLOW_BEGIN0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), 596 TRACE_EVENT_FLOW_BEGIN0("task", "SequencedWorkerPool::PostTask",
597 "SequencedWorkerPool::PostTask",
598 TRACE_ID_MANGLE(GetTaskTraceID(sequenced, static_cast<void*>(this)))); 597 TRACE_ID_MANGLE(GetTaskTraceID(sequenced, static_cast<void*>(this))));
599 598
600 sequenced.sequence_task_number = LockedGetNextSequenceTaskNumber(); 599 sequenced.sequence_task_number = LockedGetNextSequenceTaskNumber();
601 600
602 // Now that we have the lock, apply the named token rules. 601 // Now that we have the lock, apply the named token rules.
603 if (optional_token_name) 602 if (optional_token_name)
604 sequenced.sequence_token_id = LockedGetNamedTokenID(*optional_token_name); 603 sequenced.sequence_token_id = LockedGetNamedTokenID(*optional_token_name);
605 604
606 pending_tasks_.insert(sequenced); 605 pending_tasks_.insert(sequenced);
607 if (shutdown_behavior == BLOCK_SHUTDOWN) 606 if (shutdown_behavior == BLOCK_SHUTDOWN)
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 719
721 HandleCleanup(); 720 HandleCleanup();
722 721
723 // See GetWork for what delete_these_outside_lock is doing. 722 // See GetWork for what delete_these_outside_lock is doing.
724 SequencedTask task; 723 SequencedTask task;
725 TimeDelta wait_time; 724 TimeDelta wait_time;
726 std::vector<Closure> delete_these_outside_lock; 725 std::vector<Closure> delete_these_outside_lock;
727 GetWorkStatus status = 726 GetWorkStatus status =
728 GetWork(&task, &wait_time, &delete_these_outside_lock); 727 GetWork(&task, &wait_time, &delete_these_outside_lock);
729 if (status == GET_WORK_FOUND) { 728 if (status == GET_WORK_FOUND) {
730 TRACE_EVENT_FLOW_END0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), 729 TRACE_EVENT_FLOW_END0("task", "SequencedWorkerPool::PostTask",
731 "SequencedWorkerPool::PostTask",
732 TRACE_ID_MANGLE(GetTaskTraceID(task, static_cast<void*>(this)))); 730 TRACE_ID_MANGLE(GetTaskTraceID(task, static_cast<void*>(this))));
733 TRACE_EVENT2("toplevel", "SequencedWorkerPool::ThreadLoop", 731 TRACE_EVENT2("task", "SequencedWorkerPool::ThreadLoop",
734 "src_file", task.posted_from.file_name(), 732 "src_file", task.posted_from.file_name(),
735 "src_func", task.posted_from.function_name()); 733 "src_func", task.posted_from.function_name());
736 int new_thread_id = WillRunWorkerTask(task); 734 int new_thread_id = WillRunWorkerTask(task);
737 { 735 {
738 AutoUnlock unlock(lock_); 736 AutoUnlock unlock(lock_);
739 // There may be more work available, so wake up another 737 // There may be more work available, so wake up another
740 // worker thread. (Technically not required, since we 738 // worker thread. (Technically not required, since we
741 // already get a signal for each new task, but it doesn't 739 // already get a signal for each new task, but it doesn't
742 // hurt.) 740 // hurt.)
743 SignalHasWork(); 741 SignalHasWork();
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 void SequencedWorkerPool::Shutdown(int max_new_blocking_tasks_after_shutdown) { 1278 void SequencedWorkerPool::Shutdown(int max_new_blocking_tasks_after_shutdown) {
1281 DCHECK(constructor_message_loop_->BelongsToCurrentThread()); 1279 DCHECK(constructor_message_loop_->BelongsToCurrentThread());
1282 inner_->Shutdown(max_new_blocking_tasks_after_shutdown); 1280 inner_->Shutdown(max_new_blocking_tasks_after_shutdown);
1283 } 1281 }
1284 1282
1285 bool SequencedWorkerPool::IsShutdownInProgress() { 1283 bool SequencedWorkerPool::IsShutdownInProgress() {
1286 return inner_->IsShutdownInProgress(); 1284 return inner_->IsShutdownInProgress();
1287 } 1285 }
1288 1286
1289 } // namespace base 1287 } // namespace base
OLDNEW
« no previous file with comments | « base/message_loop/message_pump_gtk.cc ('k') | base/threading/worker_pool_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698