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/trace_event/trace_event_impl.h" | 5 #include "base/trace_event/trace_event_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
(...skipping 2033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2044 AutoLock thread_info_lock(thread_info_lock_); | 2044 AutoLock thread_info_lock(thread_info_lock_); |
2045 | 2045 |
2046 hash_map<int, std::string>::iterator existing_name = | 2046 hash_map<int, std::string>::iterator existing_name = |
2047 thread_names_.find(thread_id); | 2047 thread_names_.find(thread_id); |
2048 if (existing_name == thread_names_.end()) { | 2048 if (existing_name == thread_names_.end()) { |
2049 // This is a new thread id, and a new name. | 2049 // This is a new thread id, and a new name. |
2050 thread_names_[thread_id] = new_name; | 2050 thread_names_[thread_id] = new_name; |
2051 } else { | 2051 } else { |
2052 // This is a thread id that we've seen before, but potentially with a | 2052 // This is a thread id that we've seen before, but potentially with a |
2053 // new name. | 2053 // new name. |
2054 std::vector<StringPiece> existing_names; | 2054 std::vector<StringPiece> existing_names = |
2055 Tokenize(existing_name->second, ",", &existing_names); | 2055 base::SplitStringPiece(existing_name->second, ",", |
| 2056 base::KEEP_WHITESPACE, |
| 2057 base::SPLIT_WANT_NONEMPTY); |
2056 bool found = std::find(existing_names.begin(), | 2058 bool found = std::find(existing_names.begin(), |
2057 existing_names.end(), | 2059 existing_names.end(), |
2058 new_name) != existing_names.end(); | 2060 new_name) != existing_names.end(); |
2059 if (!found) { | 2061 if (!found) { |
2060 if (existing_names.size()) | 2062 if (existing_names.size()) |
2061 existing_name->second.push_back(','); | 2063 existing_name->second.push_back(','); |
2062 existing_name->second.append(new_name); | 2064 existing_name->second.append(new_name); |
2063 } | 2065 } |
2064 } | 2066 } |
2065 } | 2067 } |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2488 } | 2490 } |
2489 | 2491 |
2490 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 2492 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
2491 if (*category_group_enabled_) { | 2493 if (*category_group_enabled_) { |
2492 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, | 2494 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, |
2493 name_, event_handle_); | 2495 name_, event_handle_); |
2494 } | 2496 } |
2495 } | 2497 } |
2496 | 2498 |
2497 } // namespace trace_event_internal | 2499 } // namespace trace_event_internal |
OLD | NEW |