OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #if defined(OS_MACOSX) | 5 #if defined(OS_MACOSX) |
6 #include <signal.h> | 6 #include <signal.h> |
7 #include <unistd.h> | 7 #include <unistd.h> |
8 #endif // OS_MACOSX | 8 #endif // OS_MACOSX |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 *bad_pointer = 0; | 174 *bad_pointer = 0; |
175 } | 175 } |
176 | 176 |
177 if (command_line.HasSwitch(switches::kRendererStartupDialog)) { | 177 if (command_line.HasSwitch(switches::kRendererStartupDialog)) { |
178 ChildProcess::WaitForDebugger("Renderer"); | 178 ChildProcess::WaitForDebugger("Renderer"); |
179 } | 179 } |
180 } | 180 } |
181 | 181 |
182 // This is a simplified version of the browser Jankometer, which measures | 182 // This is a simplified version of the browser Jankometer, which measures |
183 // the processing time of tasks on the render thread. | 183 // the processing time of tasks on the render thread. |
184 class RendererMessageLoopObserver : public MessageLoop::TaskObserver { | 184 class RendererMessageLoopObserver : public MessageLoop::ClosureObserver { |
185 public: | 185 public: |
186 RendererMessageLoopObserver() | 186 RendererMessageLoopObserver() |
187 : process_times_(base::Histogram::FactoryGet( | 187 : process_times_(base::Histogram::FactoryGet( |
188 "Chrome.ProcMsgL RenderThread", | 188 "Chrome.ProcMsgL RenderThread", |
189 1, 3600000, 50, base::Histogram::kUmaTargetedHistogramFlag)) {} | 189 1, 3600000, 50, base::Histogram::kUmaTargetedHistogramFlag)) {} |
190 virtual ~RendererMessageLoopObserver() {} | 190 virtual ~RendererMessageLoopObserver() {} |
191 | 191 |
192 virtual void WillProcessTask(const Task* task) { | 192 virtual void WillProcessClosure(base::TimeTicks time_posted) { |
193 begin_process_message_ = base::TimeTicks::Now(); | 193 begin_process_message_ = base::TimeTicks::Now(); |
194 } | 194 } |
195 | 195 |
196 virtual void DidProcessTask(const Task* task) { | 196 virtual void DidProcessClosure(base::TimeTicks time_posted) { |
197 if (begin_process_message_ != base::TimeTicks()) | 197 if (begin_process_message_ != base::TimeTicks()) |
198 process_times_->AddTime(base::TimeTicks::Now() - begin_process_message_); | 198 process_times_->AddTime(base::TimeTicks::Now() - begin_process_message_); |
199 } | 199 } |
200 | 200 |
201 private: | 201 private: |
202 base::TimeTicks begin_process_message_; | 202 base::TimeTicks begin_process_message_; |
203 scoped_refptr<base::Histogram> process_times_; | 203 scoped_refptr<base::Histogram> process_times_; |
204 DISALLOW_COPY_AND_ASSIGN(RendererMessageLoopObserver); | 204 DISALLOW_COPY_AND_ASSIGN(RendererMessageLoopObserver); |
205 }; | 205 }; |
206 | 206 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 // flag allowing us to attach a debugger. | 259 // flag allowing us to attach a debugger. |
260 // Do not move this function down since that would mean we can't easily debug | 260 // Do not move this function down since that would mean we can't easily debug |
261 // whatever occurs before it. | 261 // whatever occurs before it. |
262 HandleRendererErrorTestParameters(parsed_command_line); | 262 HandleRendererErrorTestParameters(parsed_command_line); |
263 | 263 |
264 RendererMainPlatformDelegate platform(parameters); | 264 RendererMainPlatformDelegate platform(parameters); |
265 | 265 |
266 base::StatsScope<base::StatsCounterTimer> | 266 base::StatsScope<base::StatsCounterTimer> |
267 startup_timer(chrome::Counters::renderer_main()); | 267 startup_timer(chrome::Counters::renderer_main()); |
268 | 268 |
269 RendererMessageLoopObserver task_observer; | 269 RendererMessageLoopObserver closure_observer; |
270 #if defined(OS_MACOSX) | 270 #if defined(OS_MACOSX) |
271 // As long as we use Cocoa in the renderer (for the forseeable future as of | 271 // As long as we use Cocoa in the renderer (for the forseeable future as of |
272 // now; see http://crbug.com/13890 for info) we need to have a UI loop. | 272 // now; see http://crbug.com/13890 for info) we need to have a UI loop. |
273 MessageLoop main_message_loop(MessageLoop::TYPE_UI); | 273 MessageLoop main_message_loop(MessageLoop::TYPE_UI); |
274 #else | 274 #else |
275 // The main message loop of the renderer services doesn't have IO or UI tasks, | 275 // The main message loop of the renderer services doesn't have IO or UI tasks, |
276 // unless in-process-plugins is used. | 276 // unless in-process-plugins is used. |
277 MessageLoop main_message_loop(RenderProcessImpl::InProcessPlugins() ? | 277 MessageLoop main_message_loop(RenderProcessImpl::InProcessPlugins() ? |
278 MessageLoop::TYPE_UI : MessageLoop::TYPE_DEFAULT); | 278 MessageLoop::TYPE_UI : MessageLoop::TYPE_DEFAULT); |
279 #endif | 279 #endif |
280 main_message_loop.AddTaskObserver(&task_observer); | 280 main_message_loop.AddClosureObserver(&closure_observer); |
281 | 281 |
282 base::PlatformThread::SetName("CrRendererMain"); | 282 base::PlatformThread::SetName("CrRendererMain"); |
283 | 283 |
284 ui::SystemMonitor system_monitor; | 284 ui::SystemMonitor system_monitor; |
285 HighResolutionTimerManager hi_res_timer_manager; | 285 HighResolutionTimerManager hi_res_timer_manager; |
286 | 286 |
287 platform.PlatformInitialize(); | 287 platform.PlatformInitialize(); |
288 | 288 |
289 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); | 289 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); |
290 platform.InitSandboxTests(no_sandbox); | 290 platform.InitSandboxTests(no_sandbox); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 pool->Recycle(); | 336 pool->Recycle(); |
337 TRACE_EVENT_BEGIN("RendererMain.START_MSG_LOOP", 0, 0); | 337 TRACE_EVENT_BEGIN("RendererMain.START_MSG_LOOP", 0, 0); |
338 MessageLoop::current()->Run(); | 338 MessageLoop::current()->Run(); |
339 TRACE_EVENT_END("RendererMain.START_MSG_LOOP", 0, 0); | 339 TRACE_EVENT_END("RendererMain.START_MSG_LOOP", 0, 0); |
340 } | 340 } |
341 } | 341 } |
342 platform.PlatformUninitialize(); | 342 platform.PlatformUninitialize(); |
343 TRACE_EVENT_END("RendererMain", 0, ""); | 343 TRACE_EVENT_END("RendererMain", 0, ""); |
344 return 0; | 344 return 0; |
345 } | 345 } |
OLD | NEW |