| 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 "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" | |
| 15 #include "base/metrics/statistics_recorder.h" | 14 #include "base/metrics/statistics_recorder.h" |
| 16 #include "base/profiler/scoped_profile.h" | 15 #include "base/profiler/scoped_profile.h" |
| 17 #include "base/profiler/scoped_tracker.h" | 16 #include "base/profiler/scoped_tracker.h" |
| 18 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 19 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" | 18 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
| 20 #include "base/trace_event/trace_event.h" | 19 #include "base/trace_event/trace_event.h" |
| 21 #include "base/tracked_objects.h" | 20 #include "base/tracked_objects.h" |
| 22 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 23 #include "components/tracing/trace_config_file.h" | 22 #include "components/tracing/trace_config_file.h" |
| 24 #include "components/tracing/tracing_switches.h" | 23 #include "components/tracing/tracing_switches.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 74 |
| 76 // On Android we normally initialize the browser in a series of UI thread | 75 // On Android we normally initialize the browser in a series of UI thread |
| 77 // tasks. While this is happening a second request can come from the OS or | 76 // tasks. While this is happening a second request can come from the OS or |
| 78 // another application to start the browser. If this happens then we must | 77 // another application to start the browser. If this happens then we must |
| 79 // not run these parts of initialization twice. | 78 // not run these parts of initialization twice. |
| 80 if (!initialization_started_) { | 79 if (!initialization_started_) { |
| 81 initialization_started_ = true; | 80 initialization_started_ = true; |
| 82 | 81 |
| 83 const base::TimeTicks start_time_step1 = base::TimeTicks::Now(); | 82 const base::TimeTicks start_time_step1 = base::TimeTicks::Now(); |
| 84 | 83 |
| 85 // Create persistent/shared memory and allow histograms to be stored in | |
| 86 // it. Memory that is not actualy used won't be physically mapped by the | |
| 87 // system. BrowserMetrics usage, as reported in UMA, peaked around 1.9MiB | |
| 88 // as of 2016-02-20. | |
| 89 base::GlobalHistogramAllocator::CreateWithLocalMemory( | |
| 90 3 << 20, // 3 MiB | |
| 91 0x935DDD43, // SHA1(BrowserMetrics) | |
| 92 "BrowserMetrics"); | |
| 93 base::GlobalHistogramAllocator::Disable(); // Enabled by experiment only. | |
| 94 | |
| 95 SkGraphics::Init(); | 84 SkGraphics::Init(); |
| 96 | 85 |
| 97 if (parameters.command_line.HasSwitch(switches::kWaitForDebugger)) | 86 if (parameters.command_line.HasSwitch(switches::kWaitForDebugger)) |
| 98 base::debug::WaitForDebugger(60, true); | 87 base::debug::WaitForDebugger(60, true); |
| 99 | 88 |
| 100 #if defined(OS_WIN) | 89 #if defined(OS_WIN) |
| 101 if (base::win::GetVersion() < base::win::VERSION_VISTA) { | 90 if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
| 102 // When "Extend support of advanced text services to all programs" | 91 // When "Extend support of advanced text services to all programs" |
| 103 // (a.k.a. Cicero Unaware Application Support; CUAS) is enabled on | 92 // (a.k.a. Cicero Unaware Application Support; CUAS) is enabled on |
| 104 // Windows XP and handwriting modules shipped with Office 2003 are | 93 // Windows XP and handwriting modules shipped with Office 2003 are |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 BrowserMainRunner* BrowserMainRunner::Create() { | 249 BrowserMainRunner* BrowserMainRunner::Create() { |
| 261 return new BrowserMainRunnerImpl(); | 250 return new BrowserMainRunnerImpl(); |
| 262 } | 251 } |
| 263 | 252 |
| 264 // static | 253 // static |
| 265 bool BrowserMainRunner::ExitedMainMessageLoop() { | 254 bool BrowserMainRunner::ExitedMainMessageLoop() { |
| 266 return g_exited_main_message_loop; | 255 return g_exited_main_message_loop; |
| 267 } | 256 } |
| 268 | 257 |
| 269 } // namespace content | 258 } // namespace content |
| OLD | NEW |