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

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

Issue 281073002: NOT FOR REVIEW: Adding prioritized incoming task queue to renderers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Prioritize input events Created 6 years, 7 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') | content/renderer/renderer_message_loop.h » ('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"
13 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
14 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
15 #include "base/metrics/statistics_recorder.h" 14 #include "base/metrics/statistics_recorder.h"
16 #include "base/metrics/stats_counters.h" 15 #include "base/metrics/stats_counters.h"
17 #include "base/path_service.h" 16 #include "base/path_service.h"
18 #include "base/pending_task.h" 17 #include "base/pending_task.h"
19 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
20 #include "base/threading/platform_thread.h" 19 #include "base/threading/platform_thread.h"
21 #include "base/time/time.h" 20 #include "base/time/time.h"
22 #include "base/timer/hi_res_timer_manager.h" 21 #include "base/timer/hi_res_timer_manager.h"
23 #include "content/child/child_process.h" 22 #include "content/child/child_process.h"
24 #include "content/child/content_child_helpers.h" 23 #include "content/child/content_child_helpers.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"
30 #include "content/renderer/pepper/pepper_plugin_registry.h" 29 #include "content/renderer/pepper/pepper_plugin_registry.h"
31 #include "content/renderer/render_process_impl.h" 30 #include "content/renderer/render_process_impl.h"
32 #include "content/renderer/render_thread_impl.h" 31 #include "content/renderer/render_thread_impl.h"
33 #include "content/renderer/renderer_main_platform_delegate.h" 32 #include "content/renderer/renderer_main_platform_delegate.h"
33 #include "content/renderer/renderer_message_loop.h"
34 #include "ui/base/ui_base_switches.h" 34 #include "ui/base/ui_base_switches.h"
35 35
36 #if defined(OS_ANDROID) 36 #if defined(OS_ANDROID)
37 #include "base/android/sys_utils.h" 37 #include "base/android/sys_utils.h"
38 #include "third_party/skia/include/core/SkGraphics.h" 38 #include "third_party/skia/include/core/SkGraphics.h"
39 #endif // OS_ANDROID 39 #endif // OS_ANDROID
40 40
41 #if defined(OS_MACOSX) 41 #if defined(OS_MACOSX)
42 #include <Carbon/Carbon.h> 42 #include <Carbon/Carbon.h>
43 #include <signal.h> 43 #include <signal.h>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 base::StatsCounterTimer stats_counter_timer("Content.RendererInit"); 157 base::StatsCounterTimer stats_counter_timer("Content.RendererInit");
158 base::StatsScope<base::StatsCounterTimer> startup_timer(stats_counter_timer); 158 base::StatsScope<base::StatsCounterTimer> startup_timer(stats_counter_timer);
159 159
160 RendererMessageLoopObserver task_observer; 160 RendererMessageLoopObserver task_observer;
161 #if defined(OS_MACOSX) 161 #if defined(OS_MACOSX)
162 // As long as scrollbars on Mac are painted with Cocoa, the message pump 162 // As long as scrollbars on Mac are painted with Cocoa, the message pump
163 // needs to be backed by a Foundation-level loop to process NSTimers. See 163 // needs to be backed by a Foundation-level loop to process NSTimers. See
164 // http://crbug.com/306348#c24 for details. 164 // http://crbug.com/306348#c24 for details.
165 scoped_ptr<base::MessagePump> pump(new base::MessagePumpNSRunLoop()); 165 scoped_ptr<base::MessagePump> pump(new base::MessagePumpNSRunLoop());
166 base::MessageLoop main_message_loop(pump.Pass()); 166 RendererMessageLoop main_message_loop(pump.Pass());
167 #else 167 #else
168 // The main message loop of the renderer services doesn't have IO or UI tasks. 168 // The main message loop of the renderer services doesn't have IO or UI tasks.
169 base::MessageLoop main_message_loop; 169 RendererMessageLoop main_message_loop;
170 #endif 170 #endif
171 main_message_loop.AddTaskObserver(&task_observer); 171 main_message_loop.AddTaskObserver(&task_observer);
172 172
173 scoped_ptr<MemoryObserver> memory_observer; 173 scoped_ptr<MemoryObserver> memory_observer;
174 if (parsed_command_line.HasSwitch(switches::kMemoryMetrics)) { 174 if (parsed_command_line.HasSwitch(switches::kMemoryMetrics)) {
175 memory_observer.reset(new MemoryObserver()); 175 memory_observer.reset(new MemoryObserver());
176 main_message_loop.AddTaskObserver(memory_observer.get()); 176 main_message_loop.AddTaskObserver(memory_observer.get());
177 } 177 }
178 178
179 base::PlatformThread::SetName("CrRendererMain"); 179 base::PlatformThread::SetName("CrRendererMain");
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // is enabled, the in-process stack dumping is enabled as part of the 230 // is enabled, the in-process stack dumping is enabled as part of the
231 // EnableSandbox() call. 231 // EnableSandbox() call.
232 base::debug::EnableInProcessStackDumping(); 232 base::debug::EnableInProcessStackDumping();
233 #endif 233 #endif
234 } 234 }
235 #if defined(OS_POSIX) && !defined(OS_MACOSX) 235 #if defined(OS_POSIX) && !defined(OS_MACOSX)
236 RenderProcessImpl render_process; 236 RenderProcessImpl render_process;
237 new RenderThreadImpl(); 237 new RenderThreadImpl();
238 #endif 238 #endif
239 239
240 main_message_loop.EnableHighPriorityIncomingTaskQueue();
241
240 base::HighResolutionTimerManager hi_res_timer_manager; 242 base::HighResolutionTimerManager hi_res_timer_manager;
241 243
242 platform.RunSandboxTests(no_sandbox); 244 platform.RunSandboxTests(no_sandbox);
243 245
244 startup_timer.Stop(); // End of Startup Time Measurement. 246 startup_timer.Stop(); // End of Startup Time Measurement.
245 247
246 if (run_loop) { 248 if (run_loop) {
247 #if defined(OS_MACOSX) 249 #if defined(OS_MACOSX)
248 if (pool) 250 if (pool)
249 pool->Recycle(); 251 pool->Recycle();
250 #endif 252 #endif
251 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); 253 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0);
252 base::MessageLoop::current()->Run(); 254 base::MessageLoop::current()->Run();
253 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); 255 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0);
254 } 256 }
255 } 257 }
256 platform.PlatformUninitialize(); 258 platform.PlatformUninitialize();
257 TRACE_EVENT_END_ETW("RendererMain", 0, ""); 259 TRACE_EVENT_END_ETW("RendererMain", 0, "");
258 return 0; 260 return 0;
259 } 261 }
260 262
261 } // namespace content 263 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | content/renderer/renderer_message_loop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698