| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 #include "webrtc/base/event_tracer.h" | 10 #include "webrtc/base/event_tracer.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 std::vector<TraceEvent> trace_events_ GUARDED_BY(crit_); | 190 std::vector<TraceEvent> trace_events_ GUARDED_BY(crit_); |
| 191 rtc::PlatformThread logging_thread_; | 191 rtc::PlatformThread logging_thread_; |
| 192 rtc::Event shutdown_event_; | 192 rtc::Event shutdown_event_; |
| 193 rtc::ThreadChecker thread_checker_; | 193 rtc::ThreadChecker thread_checker_; |
| 194 FILE* output_file_ = nullptr; | 194 FILE* output_file_ = nullptr; |
| 195 bool output_file_owned_ = false; | 195 bool output_file_owned_ = false; |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 static bool EventTracingThreadFunc(void* params) { | 198 static bool EventTracingThreadFunc(void* params) { |
| 199 static_cast<EventLogger*>(params)->Log(); | 199 static_cast<EventLogger*>(params)->Log(); |
| 200 return true; | 200 // False indicates that the thread function has done its job and doesn't need |
| 201 // to be restarted again. Log() runs its own internal loop. |
| 202 return false; |
| 201 } | 203 } |
| 202 | 204 |
| 203 static EventLogger* volatile g_event_logger = nullptr; | 205 static EventLogger* volatile g_event_logger = nullptr; |
| 204 static const char* const kDisabledTracePrefix = TRACE_DISABLED_BY_DEFAULT(""); | 206 static const char* const kDisabledTracePrefix = TRACE_DISABLED_BY_DEFAULT(""); |
| 205 const unsigned char* InternalGetCategoryEnabled(const char* name) { | 207 const unsigned char* InternalGetCategoryEnabled(const char* name) { |
| 206 const char* prefix_ptr = &kDisabledTracePrefix[0]; | 208 const char* prefix_ptr = &kDisabledTracePrefix[0]; |
| 207 const char* name_ptr = name; | 209 const char* name_ptr = name; |
| 208 // Check whether name contains the default-disabled prefix. | 210 // Check whether name contains the default-disabled prefix. |
| 209 while (*prefix_ptr == *name_ptr && *prefix_ptr != '\0') { | 211 while (*prefix_ptr == *name_ptr && *prefix_ptr != '\0') { |
| 210 ++prefix_ptr; | 212 ++prefix_ptr; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 RTC_DCHECK(old_logger); | 268 RTC_DCHECK(old_logger); |
| 267 RTC_CHECK(rtc::AtomicOps::CompareAndSwapPtr( | 269 RTC_CHECK(rtc::AtomicOps::CompareAndSwapPtr( |
| 268 &g_event_logger, old_logger, | 270 &g_event_logger, old_logger, |
| 269 static_cast<EventLogger*>(nullptr)) == old_logger); | 271 static_cast<EventLogger*>(nullptr)) == old_logger); |
| 270 delete old_logger; | 272 delete old_logger; |
| 271 webrtc::SetupEventTracer(nullptr, nullptr); | 273 webrtc::SetupEventTracer(nullptr, nullptr); |
| 272 } | 274 } |
| 273 | 275 |
| 274 } // namespace tracing | 276 } // namespace tracing |
| 275 } // namespace rtc | 277 } // namespace rtc |
| OLD | NEW |