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

Side by Side Diff: chrome/common/profiling.cc

Issue 1200393002: Add more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string
Patch Set: 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 | « chrome/common/importer/firefox_importer_utils.cc ('k') | chrome/installer/setup/setup_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 (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 "chrome/common/profiling.h" 5 #include "chrome/common/profiling.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/profiler.h" 10 #include "base/debug/profiler.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 const base::CommandLine& command_line = 51 const base::CommandLine& command_line =
52 *base::CommandLine::ForCurrentProcess(); 52 *base::CommandLine::ForCurrentProcess();
53 if (command_line.HasSwitch(switches::kProfilingFile)) 53 if (command_line.HasSwitch(switches::kProfilingFile))
54 profile_name = command_line.GetSwitchValueASCII(switches::kProfilingFile); 54 profile_name = command_line.GetSwitchValueASCII(switches::kProfilingFile);
55 else 55 else
56 profile_name = std::string(kDefaultProfileName); 56 profile_name = std::string(kDefaultProfileName);
57 std::string process_type = 57 std::string process_type =
58 command_line.GetSwitchValueASCII(switches::kProcessType); 58 command_line.GetSwitchValueASCII(switches::kProcessType);
59 std::string type = process_type.empty() ? 59 std::string type = process_type.empty() ?
60 std::string("browser") : std::string(process_type); 60 std::string("browser") : std::string(process_type);
61 ReplaceSubstringsAfterOffset(&profile_name, 0, "{type}", type.c_str()); 61 base::ReplaceSubstringsAfterOffset(&profile_name, 0, "{type}", type);
62 } 62 }
63 return profile_name; 63 return profile_name;
64 } 64 }
65 65
66 void FlushProfilingData(base::Thread* thread) { 66 void FlushProfilingData(base::Thread* thread) {
67 static const int kProfilingFlushSeconds = 10; 67 static const int kProfilingFlushSeconds = 10;
68 68
69 if (!Profiling::BeingProfiled()) 69 if (!Profiling::BeingProfiled())
70 return; 70 return;
71 71
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 return base::debug::BeingProfiled(); 190 return base::debug::BeingProfiled();
191 } 191 }
192 192
193 // static 193 // static
194 void Profiling::Toggle() { 194 void Profiling::Toggle() {
195 if (BeingProfiled()) 195 if (BeingProfiled())
196 Stop(); 196 Stop();
197 else 197 else
198 Start(); 198 Start();
199 } 199 }
OLDNEW
« no previous file with comments | « chrome/common/importer/firefox_importer_utils.cc ('k') | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698