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