Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: base/trace_event/trace_event_impl.cc

Issue 1197243004: Replace some Tokenize calls with SplitString. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/test/test_reg_util_win.cc ('k') | base/trace_event/trace_event_memory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « base/test/test_reg_util_win.cc ('k') | base/trace_event/trace_event_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698