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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/leak_annotations.h" | 10 #include "base/debug/leak_annotations.h" |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 return new TraceBufferDiscardsEvents(); | 1043 return new TraceBufferDiscardsEvents(); |
1044 return new TraceBufferVector(); | 1044 return new TraceBufferVector(); |
1045 } | 1045 } |
1046 | 1046 |
1047 void TraceLog::SetEventCallback(EventCallback cb) { | 1047 void TraceLog::SetEventCallback(EventCallback cb) { |
1048 AutoLock lock(lock_); | 1048 AutoLock lock(lock_); |
1049 event_callback_ = cb; | 1049 event_callback_ = cb; |
1050 }; | 1050 }; |
1051 | 1051 |
1052 void TraceLog::Flush(const TraceLog::OutputCallback& cb) { | 1052 void TraceLog::Flush(const TraceLog::OutputCallback& cb) { |
| 1053 // Ignore memory allocations from here down. |
| 1054 TRACE_MEMORY(TRACE_DISABLED_BY_DEFAULT("memory"), TRACE_MEMORY_IGNORE); |
1053 scoped_ptr<TraceBuffer> previous_logged_events; | 1055 scoped_ptr<TraceBuffer> previous_logged_events; |
1054 { | 1056 { |
1055 AutoLock lock(lock_); | 1057 AutoLock lock(lock_); |
1056 previous_logged_events.swap(logged_events_); | 1058 previous_logged_events.swap(logged_events_); |
1057 logged_events_.reset(GetTraceBuffer()); | 1059 logged_events_.reset(GetTraceBuffer()); |
1058 } // release lock | 1060 } // release lock |
1059 | 1061 |
1060 while (previous_logged_events->HasMoreEvents()) { | 1062 while (previous_logged_events->HasMoreEvents()) { |
1061 scoped_refptr<RefCountedString> json_events_str_ptr = | 1063 scoped_refptr<RefCountedString> json_events_str_ptr = |
1062 new RefCountedString(); | 1064 new RefCountedString(); |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 0, // num_args | 1522 0, // num_args |
1521 NULL, // arg_names | 1523 NULL, // arg_names |
1522 NULL, // arg_types | 1524 NULL, // arg_types |
1523 NULL, // arg_values | 1525 NULL, // arg_values |
1524 NULL, // convertable values | 1526 NULL, // convertable values |
1525 TRACE_EVENT_FLAG_NONE); // flags | 1527 TRACE_EVENT_FLAG_NONE); // flags |
1526 } | 1528 } |
1527 } | 1529 } |
1528 | 1530 |
1529 } // namespace trace_event_internal | 1531 } // namespace trace_event_internal |
OLD | NEW |