OLD | NEW |
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 | 5 |
6 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ | 6 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ |
7 #define BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ | 7 #define BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ |
8 | 8 |
9 #include <stack> | 9 #include <stack> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/atomicops.h" | 13 #include "base/atomicops.h" |
14 #include "base/base_export.h" | 14 #include "base/base_export.h" |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
18 #include "base/memory/ref_counted_memory.h" | 18 #include "base/memory/ref_counted_memory.h" |
19 #include "base/memory/scoped_vector.h" | 19 #include "base/memory/scoped_vector.h" |
20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
| 21 #include "base/single_thread_task_runner.h" |
21 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
22 #include "base/synchronization/condition_variable.h" | 23 #include "base/synchronization/condition_variable.h" |
23 #include "base/synchronization/lock.h" | 24 #include "base/synchronization/lock.h" |
24 #include "base/threading/thread.h" | 25 #include "base/threading/thread.h" |
25 #include "base/threading/thread_local.h" | 26 #include "base/threading/thread_local.h" |
26 | 27 |
27 // Older style trace macros with explicit id and extra data | 28 // Older style trace macros with explicit id and extra data |
28 // Only these macros result in publishing data to ETW as currently implemented. | 29 // Only these macros result in publishing data to ETW as currently implemented. |
29 // TODO(georgesak): Update/replace these with new ETW macros. | 30 // TODO(georgesak): Update/replace these with new ETW macros. |
30 #define TRACE_EVENT_BEGIN_ETW(name, id, extra) \ | 31 #define TRACE_EVENT_BEGIN_ETW(name, id, extra) \ |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 PlatformThreadHandle sampling_thread_handle_; | 792 PlatformThreadHandle sampling_thread_handle_; |
792 | 793 |
793 CategoryFilter category_filter_; | 794 CategoryFilter category_filter_; |
794 CategoryFilter event_callback_category_filter_; | 795 CategoryFilter event_callback_category_filter_; |
795 | 796 |
796 ThreadLocalPointer<ThreadLocalEventBuffer> thread_local_event_buffer_; | 797 ThreadLocalPointer<ThreadLocalEventBuffer> thread_local_event_buffer_; |
797 ThreadLocalBoolean thread_blocks_message_loop_; | 798 ThreadLocalBoolean thread_blocks_message_loop_; |
798 ThreadLocalBoolean thread_is_in_trace_event_; | 799 ThreadLocalBoolean thread_is_in_trace_event_; |
799 | 800 |
800 // Contains the message loops of threads that have had at least one event | 801 // Contains the message loops of threads that have had at least one event |
801 // added into the local event buffer. Not using MessageLoopProxy because we | 802 // added into the local event buffer. Not using SingleThreadTaskRunner |
802 // need to know the life time of the message loops. | 803 // because we need to know the life time of the message loops. |
803 hash_set<MessageLoop*> thread_message_loops_; | 804 hash_set<MessageLoop*> thread_message_loops_; |
804 | 805 |
805 // For events which can't be added into the thread local buffer, e.g. events | 806 // For events which can't be added into the thread local buffer, e.g. events |
806 // from threads without a message loop. | 807 // from threads without a message loop. |
807 scoped_ptr<TraceBufferChunk> thread_shared_chunk_; | 808 scoped_ptr<TraceBufferChunk> thread_shared_chunk_; |
808 size_t thread_shared_chunk_index_; | 809 size_t thread_shared_chunk_index_; |
809 | 810 |
810 // Set when asynchronous Flush is in progress. | 811 // Set when asynchronous Flush is in progress. |
811 OutputCallback flush_output_callback_; | 812 OutputCallback flush_output_callback_; |
812 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; | 813 scoped_refptr<SingleThreadTaskRunner> flush_task_runner_; |
813 subtle::AtomicWord generation_; | 814 subtle::AtomicWord generation_; |
814 bool use_worker_thread_; | 815 bool use_worker_thread_; |
815 | 816 |
816 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 817 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
817 }; | 818 }; |
818 | 819 |
819 } // namespace trace_event | 820 } // namespace trace_event |
820 } // namespace base | 821 } // namespace base |
821 | 822 |
822 #endif // BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ | 823 #endif // BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ |
OLD | NEW |