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