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

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

Issue 1929913002: [tracing] Add task execution event for sequenced worker pool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 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
« no previous file with comments | « no previous file | no next file » | 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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 13 matching lines...) Expand all
24 #include "base/stl_util.h" 24 #include "base/stl_util.h"
25 #include "base/strings/stringprintf.h" 25 #include "base/strings/stringprintf.h"
26 #include "base/synchronization/condition_variable.h" 26 #include "base/synchronization/condition_variable.h"
27 #include "base/synchronization/lock.h" 27 #include "base/synchronization/lock.h"
28 #include "base/threading/platform_thread.h" 28 #include "base/threading/platform_thread.h"
29 #include "base/threading/simple_thread.h" 29 #include "base/threading/simple_thread.h"
30 #include "base/threading/thread_local.h" 30 #include "base/threading/thread_local.h"
31 #include "base/threading/thread_restrictions.h" 31 #include "base/threading/thread_restrictions.h"
32 #include "base/threading/thread_task_runner_handle.h" 32 #include "base/threading/thread_task_runner_handle.h"
33 #include "base/time/time.h" 33 #include "base/time/time.h"
34 #include "base/trace_event/heap_profiler.h"
34 #include "base/trace_event/trace_event.h" 35 #include "base/trace_event/trace_event.h"
35 #include "base/tracked_objects.h" 36 #include "base/tracked_objects.h"
36 #include "build/build_config.h" 37 #include "build/build_config.h"
37 38
38 #if defined(OS_MACOSX) 39 #if defined(OS_MACOSX)
39 #include "base/mac/scoped_nsautorelease_pool.h" 40 #include "base/mac/scoped_nsautorelease_pool.h"
40 #elif defined(OS_WIN) 41 #elif defined(OS_WIN)
41 #include "base/win/scoped_com_initializer.h" 42 #include "base/win/scoped_com_initializer.h"
42 #endif 43 #endif
43 44
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 std::vector<Closure> delete_these_outside_lock; 804 std::vector<Closure> delete_these_outside_lock;
804 GetWorkStatus status = 805 GetWorkStatus status =
805 GetWork(&task, &wait_time, &delete_these_outside_lock); 806 GetWork(&task, &wait_time, &delete_these_outside_lock);
806 if (status == GET_WORK_FOUND) { 807 if (status == GET_WORK_FOUND) {
807 TRACE_EVENT_WITH_FLOW2(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), 808 TRACE_EVENT_WITH_FLOW2(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"),
808 "SequencedWorkerPool::Inner::ThreadLoop", 809 "SequencedWorkerPool::Inner::ThreadLoop",
809 TRACE_ID_MANGLE(GetTaskTraceID(task, static_cast<void*>(this))), 810 TRACE_ID_MANGLE(GetTaskTraceID(task, static_cast<void*>(this))),
810 TRACE_EVENT_FLAG_FLOW_IN, 811 TRACE_EVENT_FLAG_FLOW_IN,
811 "src_file", task.posted_from.file_name(), 812 "src_file", task.posted_from.file_name(),
812 "src_func", task.posted_from.function_name()); 813 "src_func", task.posted_from.function_name());
814 TRACE_HEAP_PROFILER_API_SCOPED_TASK_EXECUTION task_event(
815 task.posted_from.file_name());
813 int new_thread_id = WillRunWorkerTask(task); 816 int new_thread_id = WillRunWorkerTask(task);
814 { 817 {
815 AutoUnlock unlock(lock_); 818 AutoUnlock unlock(lock_);
816 // There may be more work available, so wake up another 819 // There may be more work available, so wake up another
817 // worker thread. (Technically not required, since we 820 // worker thread. (Technically not required, since we
818 // already get a signal for each new task, but it doesn't 821 // already get a signal for each new task, but it doesn't
819 // hurt.) 822 // hurt.)
820 SignalHasWork(); 823 SignalHasWork();
821 delete_these_outside_lock.clear(); 824 delete_these_outside_lock.clear();
822 825
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 void SequencedWorkerPool::Shutdown(int max_new_blocking_tasks_after_shutdown) { 1399 void SequencedWorkerPool::Shutdown(int max_new_blocking_tasks_after_shutdown) {
1397 DCHECK(constructor_task_runner_->BelongsToCurrentThread()); 1400 DCHECK(constructor_task_runner_->BelongsToCurrentThread());
1398 inner_->Shutdown(max_new_blocking_tasks_after_shutdown); 1401 inner_->Shutdown(max_new_blocking_tasks_after_shutdown);
1399 } 1402 }
1400 1403
1401 bool SequencedWorkerPool::IsShutdownInProgress() { 1404 bool SequencedWorkerPool::IsShutdownInProgress() {
1402 return inner_->IsShutdownInProgress(); 1405 return inner_->IsShutdownInProgress();
1403 } 1406 }
1404 1407
1405 } // namespace base 1408 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698