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

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

Issue 608043002: Revert of Pending tasks in a message loop should be deleted before shutting down Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | no next file » | 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"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 base::StatsCounterTimer stats_counter_timer("Content.RendererInit"); 143 base::StatsCounterTimer stats_counter_timer("Content.RendererInit");
144 base::StatsScope<base::StatsCounterTimer> startup_timer(stats_counter_timer); 144 base::StatsScope<base::StatsCounterTimer> startup_timer(stats_counter_timer);
145 145
146 RendererMessageLoopObserver task_observer; 146 RendererMessageLoopObserver task_observer;
147 #if defined(OS_MACOSX) 147 #if defined(OS_MACOSX)
148 // As long as scrollbars on Mac are painted with Cocoa, the message pump 148 // As long as scrollbars on Mac are painted with Cocoa, the message pump
149 // needs to be backed by a Foundation-level loop to process NSTimers. See 149 // needs to be backed by a Foundation-level loop to process NSTimers. See
150 // http://crbug.com/306348#c24 for details. 150 // http://crbug.com/306348#c24 for details.
151 scoped_ptr<base::MessagePump> pump(new base::MessagePumpNSRunLoop()); 151 scoped_ptr<base::MessagePump> pump(new base::MessagePumpNSRunLoop());
152 scoped_ptr<base::MessageLoop> main_message_loop( 152 base::MessageLoop main_message_loop(pump.Pass());
153 new base::MessageLoop(pump.Pass()));
154 #else 153 #else
155 // The main message loop of the renderer services doesn't have IO or UI tasks. 154 // The main message loop of the renderer services doesn't have IO or UI tasks.
156 scoped_ptr<base::MessageLoop> main_message_loop(new base::MessageLoop()); 155 base::MessageLoop main_message_loop;
157 #endif 156 #endif
158 main_message_loop->AddTaskObserver(&task_observer); 157 main_message_loop.AddTaskObserver(&task_observer);
159 158
160 base::PlatformThread::SetName("CrRendererMain"); 159 base::PlatformThread::SetName("CrRendererMain");
161 160
162 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); 161 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox);
163 162
164 // Initialize histogram statistics gathering system. 163 // Initialize histogram statistics gathering system.
165 base::StatisticsRecorder::Initialize(); 164 base::StatisticsRecorder::Initialize();
166 165
167 // Initialize statistical testing infrastructure. We set the entropy provider 166 // Initialize statistical testing infrastructure. We set the entropy provider
168 // to NULL to disallow the renderer process from creating its own one-time 167 // to NULL to disallow the renderer process from creating its own one-time
(...skipping 23 matching lines...) Expand all
192 // zygote_main_linux.cc. However, calling multiple times from the same thread 191 // zygote_main_linux.cc. However, calling multiple times from the same thread
193 // is OK. 192 // is OK.
194 InitializeWebRtcModule(); 193 InitializeWebRtcModule();
195 #endif 194 #endif
196 195
197 { 196 {
198 #if defined(OS_WIN) || defined(OS_MACOSX) 197 #if defined(OS_WIN) || defined(OS_MACOSX)
199 // TODO(markus): Check if it is OK to unconditionally move this 198 // TODO(markus): Check if it is OK to unconditionally move this
200 // instruction down. 199 // instruction down.
201 RenderProcessImpl render_process; 200 RenderProcessImpl render_process;
202 new RenderThreadImpl(main_message_loop.Pass()); 201 new RenderThreadImpl();
203 #endif 202 #endif
204 bool run_loop = true; 203 bool run_loop = true;
205 if (!no_sandbox) { 204 if (!no_sandbox) {
206 run_loop = platform.EnableSandbox(); 205 run_loop = platform.EnableSandbox();
207 } else { 206 } else {
208 LOG(ERROR) << "Running without renderer sandbox"; 207 LOG(ERROR) << "Running without renderer sandbox";
209 #ifndef NDEBUG 208 #ifndef NDEBUG
210 // For convenience, we print the stack traces for crashes. When sandbox 209 // For convenience, we print the stack traces for crashes. When sandbox
211 // is enabled, the in-process stack dumping is enabled as part of the 210 // is enabled, the in-process stack dumping is enabled as part of the
212 // EnableSandbox() call. 211 // EnableSandbox() call.
213 base::debug::EnableInProcessStackDumping(); 212 base::debug::EnableInProcessStackDumping();
214 #endif 213 #endif
215 } 214 }
216 #if defined(OS_POSIX) && !defined(OS_MACOSX) 215 #if defined(OS_POSIX) && !defined(OS_MACOSX)
217 RenderProcessImpl render_process; 216 RenderProcessImpl render_process;
218 new RenderThreadImpl(main_message_loop.Pass()); 217 new RenderThreadImpl();
219 #endif 218 #endif
220 219
221 base::HighResolutionTimerManager hi_res_timer_manager; 220 base::HighResolutionTimerManager hi_res_timer_manager;
222 221
223 startup_timer.Stop(); // End of Startup Time Measurement. 222 startup_timer.Stop(); // End of Startup Time Measurement.
224 223
225 if (run_loop) { 224 if (run_loop) {
226 #if defined(OS_MACOSX) 225 #if defined(OS_MACOSX)
227 if (pool) 226 if (pool)
228 pool->Recycle(); 227 pool->Recycle();
229 #endif 228 #endif
230 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); 229 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0);
231 base::MessageLoop::current()->Run(); 230 base::MessageLoop::current()->Run();
232 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); 231 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0);
233 } 232 }
234 } 233 }
235 platform.PlatformUninitialize(); 234 platform.PlatformUninitialize();
236 TRACE_EVENT_END_ETW("RendererMain", 0, ""); 235 TRACE_EVENT_END_ETW("RendererMain", 0, "");
237 return 0; 236 return 0;
238 } 237 }
239 238
240 } // namespace content 239 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698