| 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.h" | 5 #include "base/debug/trace_event.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 "__metadata", | 56 "__metadata", |
| 57 }; | 57 }; |
| 58 // The enabled flag is char instead of bool so that the API can be used from C. | 58 // The enabled flag is char instead of bool so that the API can be used from C. |
| 59 unsigned char g_category_enabled[TRACE_EVENT_MAX_CATEGORIES] = { 0 }; | 59 unsigned char g_category_enabled[TRACE_EVENT_MAX_CATEGORIES] = { 0 }; |
| 60 const int g_category_already_shutdown = 0; | 60 const int g_category_already_shutdown = 0; |
| 61 const int g_category_categories_exhausted = 1; | 61 const int g_category_categories_exhausted = 1; |
| 62 const int g_category_metadata = 2; | 62 const int g_category_metadata = 2; |
| 63 int g_category_index = 3; // skip initial 3 categories | 63 int g_category_index = 3; // skip initial 3 categories |
| 64 | 64 |
| 65 // The most-recently captured name of the current thread | 65 // The most-recently captured name of the current thread |
| 66 LazyInstance<ThreadLocalPointer<const char>, | 66 LazyInstance<ThreadLocalPointer<const char> >::Leaky |
| 67 LeakyLazyInstanceTraits<ThreadLocalPointer<const char> > > | |
| 68 g_current_thread_name = LAZY_INSTANCE_INITIALIZER; | 67 g_current_thread_name = LAZY_INSTANCE_INITIALIZER; |
| 69 | 68 |
| 70 void AppendValueAsJSON(unsigned char type, | 69 void AppendValueAsJSON(unsigned char type, |
| 71 TraceEvent::TraceValue value, | 70 TraceEvent::TraceValue value, |
| 72 std::string* out) { | 71 std::string* out) { |
| 73 std::string::size_type start_pos; | 72 std::string::size_type start_pos; |
| 74 switch (type) { | 73 switch (type) { |
| 75 case TRACE_VALUE_TYPE_BOOL: | 74 case TRACE_VALUE_TYPE_BOOL: |
| 76 *out += value.as_bool ? "true" : "false"; | 75 *out += value.as_bool ? "true" : "false"; |
| 77 break; | 76 break; |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 TRACE_EVENT_PHASE_END, | 784 TRACE_EVENT_PHASE_END, |
| 786 p_data_->category_enabled, | 785 p_data_->category_enabled, |
| 787 p_data_->name, kNoEventId, | 786 p_data_->name, kNoEventId, |
| 788 kZeroNumArgs, NULL, NULL, NULL, | 787 kZeroNumArgs, NULL, NULL, NULL, |
| 789 p_data_->threshold_begin_id, p_data_->threshold, | 788 p_data_->threshold_begin_id, p_data_->threshold, |
| 790 TRACE_EVENT_FLAG_NONE); | 789 TRACE_EVENT_FLAG_NONE); |
| 791 } | 790 } |
| 792 } | 791 } |
| 793 | 792 |
| 794 } // namespace trace_event_internal | 793 } // namespace trace_event_internal |
| OLD | NEW |