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/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 27 matching lines...) Expand all Loading... |
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> |
44 #include <unistd.h> | 44 #include <unistd.h> |
45 | 45 |
46 #include "base/mac/mac_util.h" | 46 #include "base/mac/mac_util.h" |
47 #include "base/mac/scoped_nsautorelease_pool.h" | 47 #include "base/mac/scoped_nsautorelease_pool.h" |
| 48 #include "base/message_loop/message_pump_mac.h" |
48 #include "third_party/WebKit/public/web/WebView.h" | 49 #include "third_party/WebKit/public/web/WebView.h" |
49 #endif // OS_MACOSX | 50 #endif // OS_MACOSX |
50 | 51 |
51 #if defined(ENABLE_WEBRTC) | 52 #if defined(ENABLE_WEBRTC) |
52 #include "third_party/libjingle/overrides/init_webrtc.h" | 53 #include "third_party/libjingle/overrides/init_webrtc.h" |
53 #endif | 54 #endif |
54 | 55 |
55 namespace content { | 56 namespace content { |
56 namespace { | 57 namespace { |
57 // This function provides some ways to test crash and assertion handling | 58 // This function provides some ways to test crash and assertion handling |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 HandleRendererErrorTestParameters(parsed_command_line); | 152 HandleRendererErrorTestParameters(parsed_command_line); |
152 | 153 |
153 RendererMainPlatformDelegate platform(parameters); | 154 RendererMainPlatformDelegate platform(parameters); |
154 | 155 |
155 | 156 |
156 base::StatsCounterTimer stats_counter_timer("Content.RendererInit"); | 157 base::StatsCounterTimer stats_counter_timer("Content.RendererInit"); |
157 base::StatsScope<base::StatsCounterTimer> startup_timer(stats_counter_timer); | 158 base::StatsScope<base::StatsCounterTimer> startup_timer(stats_counter_timer); |
158 | 159 |
159 RendererMessageLoopObserver task_observer; | 160 RendererMessageLoopObserver task_observer; |
160 #if defined(OS_MACOSX) | 161 #if defined(OS_MACOSX) |
161 // As long as we use Cocoa in the renderer (for the forseeable future as of | 162 // As long as scrollbars on Mac are painted with Cocoa, the message pump |
162 // now; see http://crbug.com/306348 for info) we need to have a UI loop. | 163 // needs to be backed by a Foundation-level loop to process NSTimers. See |
163 base::MessageLoopForUI main_message_loop; | 164 // http://crbug.com/306348#c24 for details. |
| 165 scoped_ptr<base::MessagePump> pump(new base::MessagePumpNSRunLoop()); |
| 166 base::MessageLoop main_message_loop(pump.Pass()); |
164 #else | 167 #else |
165 // 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. |
166 base::MessageLoop main_message_loop; | 169 base::MessageLoop main_message_loop; |
167 #endif | 170 #endif |
168 main_message_loop.AddTaskObserver(&task_observer); | 171 main_message_loop.AddTaskObserver(&task_observer); |
169 | 172 |
170 scoped_ptr<MemoryObserver> memory_observer; | 173 scoped_ptr<MemoryObserver> memory_observer; |
171 if (parsed_command_line.HasSwitch(switches::kMemoryMetrics)) { | 174 if (parsed_command_line.HasSwitch(switches::kMemoryMetrics)) { |
172 memory_observer.reset(new MemoryObserver()); | 175 memory_observer.reset(new MemoryObserver()); |
173 main_message_loop.AddTaskObserver(memory_observer.get()); | 176 main_message_loop.AddTaskObserver(memory_observer.get()); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 base::MessageLoop::current()->Run(); | 252 base::MessageLoop::current()->Run(); |
250 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 253 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
251 } | 254 } |
252 } | 255 } |
253 platform.PlatformUninitialize(); | 256 platform.PlatformUninitialize(); |
254 TRACE_EVENT_END_ETW("RendererMain", 0, ""); | 257 TRACE_EVENT_END_ETW("RendererMain", 0, ""); |
255 return 0; | 258 return 0; |
256 } | 259 } |
257 | 260 |
258 } // namespace content | 261 } // namespace content |
OLD | NEW |