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

Side by Side Diff: content/browser/browser_main_runner.cc

Issue 1891913002: Support saving browser metrics to disk and reading them during next run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: back-out PrepareDifference change Created 4 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
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 "content/public/browser/browser_main_runner.h" 5 #include "content/public/browser/browser_main_runner.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/leak_annotations.h" 9 #include "base/debug/leak_annotations.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
14 #include "base/metrics/persistent_histogram_allocator.h"
14 #include "base/metrics/statistics_recorder.h" 15 #include "base/metrics/statistics_recorder.h"
15 #include "base/profiler/scoped_profile.h" 16 #include "base/profiler/scoped_profile.h"
16 #include "base/profiler/scoped_tracker.h" 17 #include "base/profiler/scoped_tracker.h"
17 #include "base/time/time.h" 18 #include "base/time/time.h"
18 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" 19 #include "base/trace_event/heap_profiler_allocation_context_tracker.h"
19 #include "base/trace_event/trace_event.h" 20 #include "base/trace_event/trace_event.h"
20 #include "base/tracked_objects.h" 21 #include "base/tracked_objects.h"
21 #include "build/build_config.h" 22 #include "build/build_config.h"
22 #include "components/tracing/trace_config_file.h" 23 #include "components/tracing/trace_config_file.h"
23 #include "components/tracing/tracing_switches.h" 24 #include "components/tracing/tracing_switches.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // Forcefully terminates the RunLoop inside MessagePumpForUI, ensuring 218 // Forcefully terminates the RunLoop inside MessagePumpForUI, ensuring
218 // proper shutdown for content_browsertests. Shutdown() is not used by 219 // proper shutdown for content_browsertests. Shutdown() is not used by
219 // the actual browser. 220 // the actual browser.
220 if (base::MessageLoop::current()->is_running()) 221 if (base::MessageLoop::current()->is_running())
221 base::MessageLoop::current()->QuitNow(); 222 base::MessageLoop::current()->QuitNow();
222 #endif 223 #endif
223 main_loop_.reset(NULL); 224 main_loop_.reset(NULL);
224 225
225 notification_service_.reset(NULL); 226 notification_service_.reset(NULL);
226 227
228 // Dump all the persistent metrics to a file for upload during the next
229 // run of the browser.
230 base::GlobalHistogramAllocator* allocator =
231 base::GlobalHistogramAllocator::Get();
232 if (allocator)
233 allocator->WriteToPersistentLocation();
234
227 is_shutdown_ = true; 235 is_shutdown_ = true;
228 } 236 }
229 } 237 }
230 238
231 protected: 239 protected:
232 // True if we have started to initialize the runner. 240 // True if we have started to initialize the runner.
233 bool initialization_started_; 241 bool initialization_started_;
234 242
235 // True if the runner has been shut down. 243 // True if the runner has been shut down.
236 bool is_shutdown_; 244 bool is_shutdown_;
(...skipping 12 matching lines...) Expand all
249 BrowserMainRunner* BrowserMainRunner::Create() { 257 BrowserMainRunner* BrowserMainRunner::Create() {
250 return new BrowserMainRunnerImpl(); 258 return new BrowserMainRunnerImpl();
251 } 259 }
252 260
253 // static 261 // static
254 bool BrowserMainRunner::ExitedMainMessageLoop() { 262 bool BrowserMainRunner::ExitedMainMessageLoop() {
255 return g_exited_main_message_loop; 263 return g_exited_main_message_loop;
256 } 264 }
257 265
258 } // namespace content 266 } // namespace content
OLDNEW
« components/metrics/file_metrics_provider.cc ('K') | « components/metrics/file_metrics_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698