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

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

Issue 2695883003: Change uses of base::JoinString to pass StringPieces where possible. (Closed)
Patch Set: Remove dependency CL. Created 3 years, 8 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/launcher/test_launcher.cc ('k') | chrome/browser/chrome_browser_main.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_log.h" 5 #include "base/trace_event/trace_log.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/base_switches.h" 12 #include "base/base_switches.h"
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/debug/leak_annotations.h" 15 #include "base/debug/leak_annotations.h"
16 #include "base/location.h" 16 #include "base/location.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/ptr_util.h" 18 #include "base/memory/ptr_util.h"
19 #include "base/memory/ref_counted_memory.h" 19 #include "base/memory/ref_counted_memory.h"
20 #include "base/memory/singleton.h" 20 #include "base/memory/singleton.h"
21 #include "base/message_loop/message_loop.h" 21 #include "base/message_loop/message_loop.h"
22 #include "base/process/process_info.h" 22 #include "base/process/process_info.h"
23 #include "base/process/process_metrics.h" 23 #include "base/process/process_metrics.h"
24 #include "base/stl_util.h" 24 #include "base/stl_util.h"
25 #include "base/strings/string_piece.h"
25 #include "base/strings/string_split.h" 26 #include "base/strings/string_split.h"
26 #include "base/strings/string_tokenizer.h" 27 #include "base/strings/string_tokenizer.h"
27 #include "base/strings/stringprintf.h" 28 #include "base/strings/stringprintf.h"
28 #include "base/sys_info.h" 29 #include "base/sys_info.h"
29 #include "base/task_scheduler/post_task.h" 30 #include "base/task_scheduler/post_task.h"
30 #include "base/threading/platform_thread.h" 31 #include "base/threading/platform_thread.h"
31 #include "base/threading/thread_id_name_manager.h" 32 #include "base/threading/thread_id_name_manager.h"
32 #include "base/threading/thread_task_runner_handle.h" 33 #include "base/threading/thread_task_runner_handle.h"
33 #include "base/time/time.h" 34 #include "base/time/time.h"
34 #include "base/trace_event/category_registry.h" 35 #include "base/trace_event/category_registry.h"
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 Time process_creation_time = CurrentProcessInfo::CreationTime(); 1506 Time process_creation_time = CurrentProcessInfo::CreationTime();
1506 if (!process_creation_time.is_null()) { 1507 if (!process_creation_time.is_null()) {
1507 TimeDelta process_uptime = Time::Now() - process_creation_time; 1508 TimeDelta process_uptime = Time::Now() - process_creation_time;
1508 InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false), 1509 InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false),
1509 current_thread_id, "process_uptime_seconds", 1510 current_thread_id, "process_uptime_seconds",
1510 "uptime", process_uptime.InSeconds()); 1511 "uptime", process_uptime.InSeconds());
1511 } 1512 }
1512 #endif // !defined(OS_NACL) && !defined(OS_IOS) 1513 #endif // !defined(OS_NACL) && !defined(OS_IOS)
1513 1514
1514 if (!process_labels_.empty()) { 1515 if (!process_labels_.empty()) {
1515 std::vector<std::string> labels; 1516 std::vector<base::StringPiece> labels;
1516 for (const auto& it : process_labels_) 1517 for (const auto& it : process_labels_)
1517 labels.push_back(it.second); 1518 labels.push_back(it.second);
1518 InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false), 1519 InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false),
1519 current_thread_id, "process_labels", "labels", 1520 current_thread_id, "process_labels", "labels",
1520 base::JoinString(labels, ",")); 1521 base::JoinString(labels, ","));
1521 } 1522 }
1522 1523
1523 // Thread sort indices. 1524 // Thread sort indices.
1524 for (const auto& it : thread_sort_indices_) { 1525 for (const auto& it : thread_sort_indices_) {
1525 if (it.second == 0) 1526 if (it.second == 0)
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1732 } 1733 }
1733 1734
1734 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { 1735 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() {
1735 if (*category_group_enabled_) { 1736 if (*category_group_enabled_) {
1736 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, 1737 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_,
1737 event_handle_); 1738 event_handle_);
1738 } 1739 }
1739 } 1740 }
1740 1741
1741 } // namespace trace_event_internal 1742 } // namespace trace_event_internal
OLDNEW
« no previous file with comments | « base/test/launcher/test_launcher.cc ('k') | chrome/browser/chrome_browser_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698