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

Side by Side Diff: content/renderer/renderer_main.cc

Issue 17074009: Created multi-process-friendly PowerMonitor interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing windows unit test errors Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « content/public/test/browser_test_base.cc ('k') | content/utility/utility_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 "base/base_switches.h" 5 #include "base/base_switches.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/debug/debugger.h" 7 #include "base/debug/debugger.h"
8 #include "base/debug/stack_trace.h" 8 #include "base/debug/stack_trace.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/metrics/statistics_recorder.h" 15 #include "base/metrics/statistics_recorder.h"
16 #include "base/metrics/stats_counters.h" 16 #include "base/metrics/stats_counters.h"
17 #include "base/path_service.h" 17 #include "base/path_service.h"
18 #include "base/pending_task.h" 18 #include "base/pending_task.h"
19 #include "base/power_monitor/power_monitor.h"
20 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
21 #include "base/threading/platform_thread.h" 20 #include "base/threading/platform_thread.h"
22 #include "base/time/time.h" 21 #include "base/time/time.h"
23 #include "base/timer/hi_res_timer_manager.h" 22 #include "base/timer/hi_res_timer_manager.h"
24 #include "content/child/child_process.h" 23 #include "content/child/child_process.h"
25 #include "content/common/content_constants_internal.h" 24 #include "content/common/content_constants_internal.h"
26 #include "content/public/common/content_switches.h" 25 #include "content/public/common/content_switches.h"
27 #include "content/public/common/main_function_params.h" 26 #include "content/public/common/main_function_params.h"
28 #include "content/public/renderer/content_renderer_client.h" 27 #include "content/public/renderer/content_renderer_client.h"
29 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h" 28 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 main_message_loop.AddTaskObserver(&task_observer); 160 main_message_loop.AddTaskObserver(&task_observer);
162 161
163 scoped_ptr<MemoryObserver> memory_observer; 162 scoped_ptr<MemoryObserver> memory_observer;
164 if (parsed_command_line.HasSwitch(switches::kMemoryMetrics)) { 163 if (parsed_command_line.HasSwitch(switches::kMemoryMetrics)) {
165 memory_observer.reset(new MemoryObserver()); 164 memory_observer.reset(new MemoryObserver());
166 main_message_loop.AddTaskObserver(memory_observer.get()); 165 main_message_loop.AddTaskObserver(memory_observer.get());
167 } 166 }
168 167
169 base::PlatformThread::SetName("CrRendererMain"); 168 base::PlatformThread::SetName("CrRendererMain");
170 169
171 base::PowerMonitor power_monitor;
172 base::HighResolutionTimerManager hi_res_timer_manager;
173
174 platform.PlatformInitialize(); 170 platform.PlatformInitialize();
175 171
176 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); 172 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox);
177 platform.InitSandboxTests(no_sandbox); 173 platform.InitSandboxTests(no_sandbox);
178 174
179 // Initialize histogram statistics gathering system. 175 // Initialize histogram statistics gathering system.
180 base::StatisticsRecorder::Initialize(); 176 base::StatisticsRecorder::Initialize();
181 177
182 // Initialize statistical testing infrastructure. We set the entropy provider 178 // Initialize statistical testing infrastructure. We set the entropy provider
183 // to NULL to disallow the renderer process from creating its own one-time 179 // to NULL to disallow the renderer process from creating its own one-time
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // symbols when the sandbox is enabled, so only try when the sandbox is 220 // symbols when the sandbox is enabled, so only try when the sandbox is
225 // disabled. 221 // disabled.
226 base::debug::EnableInProcessStackDumping(); 222 base::debug::EnableInProcessStackDumping();
227 #endif 223 #endif
228 } 224 }
229 #if defined(OS_POSIX) && !defined(OS_MACOSX) 225 #if defined(OS_POSIX) && !defined(OS_MACOSX)
230 RenderProcessImpl render_process; 226 RenderProcessImpl render_process;
231 new RenderThreadImpl(); 227 new RenderThreadImpl();
232 #endif 228 #endif
233 229
230 base::HighResolutionTimerManager hi_res_timer_manager;
231
234 platform.RunSandboxTests(no_sandbox); 232 platform.RunSandboxTests(no_sandbox);
235 233
236 startup_timer.Stop(); // End of Startup Time Measurement. 234 startup_timer.Stop(); // End of Startup Time Measurement.
237 235
238 if (run_loop) { 236 if (run_loop) {
239 #if defined(OS_MACOSX) 237 #if defined(OS_MACOSX)
240 if (pool) 238 if (pool)
241 pool->Recycle(); 239 pool->Recycle();
242 #endif 240 #endif
243 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); 241 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0);
244 base::MessageLoop::current()->Run(); 242 base::MessageLoop::current()->Run();
245 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); 243 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0);
246 } 244 }
247 } 245 }
248 platform.PlatformUninitialize(); 246 platform.PlatformUninitialize();
249 TRACE_EVENT_END_ETW("RendererMain", 0, ""); 247 TRACE_EVENT_END_ETW("RendererMain", 0, "");
250 return 0; 248 return 0;
251 } 249 }
252 250
253 } // namespace content 251 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/browser_test_base.cc ('k') | content/utility/utility_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698