| 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 #include "base/debug/trace_event_impl.h" | 5 #include "base/debug/trace_event_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 // 4. If any thread hasn't finish its flush in time, finish the flush. | 1347 // 4. If any thread hasn't finish its flush in time, finish the flush. |
| 1348 void TraceLog::Flush(const TraceLog::OutputCallback& cb) { | 1348 void TraceLog::Flush(const TraceLog::OutputCallback& cb) { |
| 1349 if (IsEnabled()) { | 1349 if (IsEnabled()) { |
| 1350 // Can't flush when tracing is enabled because otherwise PostTask would | 1350 // Can't flush when tracing is enabled because otherwise PostTask would |
| 1351 // - it generates more trace events; | 1351 // - it generates more trace events; |
| 1352 // - it deschedules the calling thread on some platforms causing inaccurate | 1352 // - it deschedules the calling thread on some platforms causing inaccurate |
| 1353 // timing of the trace events. | 1353 // timing of the trace events. |
| 1354 scoped_refptr<RefCountedString> empty_result = new RefCountedString; | 1354 scoped_refptr<RefCountedString> empty_result = new RefCountedString; |
| 1355 if (!cb.is_null()) | 1355 if (!cb.is_null()) |
| 1356 cb.Run(empty_result, false); | 1356 cb.Run(empty_result, false); |
| 1357 LOG(WARNING) << "Ignored TraceLog::Flush called when tracing is enabled"; |
| 1357 return; | 1358 return; |
| 1358 } | 1359 } |
| 1359 | 1360 |
| 1360 int flush_count; | 1361 int flush_count; |
| 1361 { | 1362 { |
| 1362 AutoLock lock(lock_); | 1363 AutoLock lock(lock_); |
| 1363 flush_count = ++flush_count_; | 1364 flush_count = ++flush_count_; |
| 1364 DCHECK(!flush_message_loop_proxy_.get()); | 1365 DCHECK(!flush_message_loop_proxy_.get()); |
| 1365 flush_message_loop_proxy_ = MessageLoopProxy::current(); | 1366 flush_message_loop_proxy_ = MessageLoopProxy::current(); |
| 1366 DCHECK(!thread_message_loops_.size() || flush_message_loop_proxy_.get()); | 1367 DCHECK(!thread_message_loops_.size() || flush_message_loop_proxy_.get()); |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2031 0, // num_args | 2032 0, // num_args |
| 2032 NULL, // arg_names | 2033 NULL, // arg_names |
| 2033 NULL, // arg_types | 2034 NULL, // arg_types |
| 2034 NULL, // arg_values | 2035 NULL, // arg_values |
| 2035 NULL, // convertable values | 2036 NULL, // convertable values |
| 2036 TRACE_EVENT_FLAG_NONE); // flags | 2037 TRACE_EVENT_FLAG_NONE); // flags |
| 2037 } | 2038 } |
| 2038 } | 2039 } |
| 2039 | 2040 |
| 2040 } // namespace trace_event_internal | 2041 } // namespace trace_event_internal |
| OLD | NEW |