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 "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/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 } | 103 } |
104 }; | 104 }; |
105 | 105 |
106 #endif // OS(POSIX) | 106 #endif // OS(POSIX) |
107 | 107 |
108 } // namespace | 108 } // namespace |
109 | 109 |
110 // This function provides some ways to test crash and assertion handling | 110 // This function provides some ways to test crash and assertion handling |
111 // behavior of the renderer. | 111 // behavior of the renderer. |
112 static void HandleRendererErrorTestParameters(const CommandLine& command_line) { | 112 static void HandleRendererErrorTestParameters(const CommandLine& command_line) { |
113 // This parameter causes an assertion. | |
114 if (command_line.HasSwitch(switches::kRendererAssertTest)) { | |
115 DCHECK(false); | |
116 } | |
117 | |
118 | |
119 #if !defined(OFFICIAL_BUILD) | |
120 // This parameter causes an assertion too. | |
121 if (command_line.HasSwitch(switches::kRendererCheckFalseTest)) { | |
122 CHECK(false); | |
123 } | |
124 #endif // !defined(OFFICIAL_BUILD) | |
125 | |
126 | |
127 // This parameter causes a null pointer crash (crash reporter trigger). | |
128 if (command_line.HasSwitch(switches::kRendererCrashTest)) { | |
129 int* bad_pointer = NULL; | |
130 *bad_pointer = 0; | |
131 } | |
132 | |
133 if (command_line.HasSwitch(switches::kWaitForDebugger)) | 113 if (command_line.HasSwitch(switches::kWaitForDebugger)) |
134 base::debug::WaitForDebugger(60, true); | 114 base::debug::WaitForDebugger(60, true); |
135 | 115 |
136 if (command_line.HasSwitch(switches::kRendererStartupDialog)) | 116 if (command_line.HasSwitch(switches::kRendererStartupDialog)) |
137 ChildProcess::WaitForDebugger("Renderer"); | 117 ChildProcess::WaitForDebugger("Renderer"); |
| 118 |
| 119 // This parameter causes an assertion. |
| 120 if (command_line.HasSwitch(switches::kRendererAssertTest)) { |
| 121 DCHECK(false); |
| 122 } |
138 } | 123 } |
139 | 124 |
140 // This is a simplified version of the browser Jankometer, which measures | 125 // This is a simplified version of the browser Jankometer, which measures |
141 // the processing time of tasks on the render thread. | 126 // the processing time of tasks on the render thread. |
142 class RendererMessageLoopObserver : public MessageLoop::TaskObserver { | 127 class RendererMessageLoopObserver : public MessageLoop::TaskObserver { |
143 public: | 128 public: |
144 RendererMessageLoopObserver() | 129 RendererMessageLoopObserver() |
145 : process_times_(base::Histogram::FactoryGet( | 130 : process_times_(base::Histogram::FactoryGet( |
146 "Chrome.ProcMsgL RenderThread", | 131 "Chrome.ProcMsgL RenderThread", |
147 1, 3600000, 50, base::Histogram::kUmaTargetedHistogramFlag)) {} | 132 1, 3600000, 50, base::Histogram::kUmaTargetedHistogramFlag)) {} |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 #endif | 264 #endif |
280 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 265 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
281 MessageLoop::current()->Run(); | 266 MessageLoop::current()->Run(); |
282 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 267 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
283 } | 268 } |
284 } | 269 } |
285 platform.PlatformUninitialize(); | 270 platform.PlatformUninitialize(); |
286 TRACE_EVENT_END_ETW("RendererMain", 0, ""); | 271 TRACE_EVENT_END_ETW("RendererMain", 0, ""); |
287 return 0; | 272 return 0; |
288 } | 273 } |
OLD | NEW |