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 "content/browser/browser_main_loop.h" | 5 #include "content/browser/browser_main_loop.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 #endif | 79 #endif |
80 | 80 |
81 #if !defined(OS_IOS) | 81 #if !defined(OS_IOS) |
82 #include "content/browser/renderer_host/render_process_host_impl.h" | 82 #include "content/browser/renderer_host/render_process_host_impl.h" |
83 #endif | 83 #endif |
84 | 84 |
85 #if defined(OS_ANDROID) | 85 #if defined(OS_ANDROID) |
86 #include "base/android/jni_android.h" | 86 #include "base/android/jni_android.h" |
87 #include "content/browser/android/browser_startup_controller.h" | 87 #include "content/browser/android/browser_startup_controller.h" |
88 #include "content/browser/android/browser_surface_texture_manager.h" | 88 #include "content/browser/android/browser_surface_texture_manager.h" |
| 89 #include "content/browser/android/in_process_surface_texture_manager.h" |
89 #include "content/browser/android/tracing_controller_android.h" | 90 #include "content/browser/android/tracing_controller_android.h" |
90 #include "content/browser/screen_orientation/screen_orientation_delegate_android
.h" | 91 #include "content/browser/screen_orientation/screen_orientation_delegate_android
.h" |
91 #include "content/public/browser/screen_orientation_provider.h" | 92 #include "content/public/browser/screen_orientation_provider.h" |
92 #include "ui/gl/gl_surface.h" | 93 #include "ui/gl/gl_surface.h" |
93 #endif | 94 #endif |
94 | 95 |
95 #if defined(OS_MACOSX) | 96 #if defined(OS_MACOSX) |
96 #include "media/base/mac/avfoundation_glue.h" | 97 #include "media/base/mac/avfoundation_glue.h" |
97 #endif | 98 #endif |
98 | 99 |
99 #if defined(OS_MACOSX) && !defined(OS_IOS) | 100 #if defined(OS_MACOSX) && !defined(OS_IOS) |
100 #include "base/memory/memory_pressure_monitor_mac.h" | 101 #include "base/memory/memory_pressure_monitor_mac.h" |
101 #include "content/browser/bootstrap_sandbox_mac.h" | 102 #include "content/browser/bootstrap_sandbox_mac.h" |
102 #include "content/browser/browser_io_surface_manager_mac.h" | 103 #include "content/browser/browser_io_surface_manager_mac.h" |
103 #include "content/browser/cocoa/system_hotkey_helper_mac.h" | 104 #include "content/browser/cocoa/system_hotkey_helper_mac.h" |
104 #include "content/browser/compositor/browser_compositor_view_mac.h" | 105 #include "content/browser/compositor/browser_compositor_view_mac.h" |
| 106 #include "content/browser/in_process_io_surface_manager_mac.h" |
105 #include "content/browser/theme_helper_mac.h" | 107 #include "content/browser/theme_helper_mac.h" |
106 #endif | 108 #endif |
107 | 109 |
108 #if defined(OS_WIN) | 110 #if defined(OS_WIN) |
109 #include <windows.h> | 111 #include <windows.h> |
110 #include <commctrl.h> | 112 #include <commctrl.h> |
111 #include <shellapi.h> | 113 #include <shellapi.h> |
112 | 114 |
113 #include "base/memory/memory_pressure_monitor_win.h" | 115 #include "base/memory/memory_pressure_monitor_win.h" |
114 #include "content/browser/system_message_window_win.h" | 116 #include "content/browser/system_message_window_win.h" |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 // MessagePumpForUI::Start() as it will crash the browser. | 584 // MessagePumpForUI::Start() as it will crash the browser. |
583 if (is_tracing_startup_) { | 585 if (is_tracing_startup_) { |
584 TRACE_EVENT0("startup", "BrowserMainLoop::InitStartupTracing"); | 586 TRACE_EVENT0("startup", "BrowserMainLoop::InitStartupTracing"); |
585 InitStartupTracing(parsed_command_line_); | 587 InitStartupTracing(parsed_command_line_); |
586 } | 588 } |
587 #endif // !defined(OS_IOS) | 589 #endif // !defined(OS_IOS) |
588 | 590 |
589 #if defined(OS_ANDROID) | 591 #if defined(OS_ANDROID) |
590 { | 592 { |
591 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SurfaceTextureManager"); | 593 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SurfaceTextureManager"); |
592 SurfaceTextureManager::SetInstance(new BrowserSurfaceTextureManager); | 594 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) { |
| 595 SurfaceTextureManager::SetInstance( |
| 596 InProcessSurfaceTextureManager::GetInstance()); |
| 597 } else { |
| 598 SurfaceTextureManager::SetInstance( |
| 599 BrowserSurfaceTextureManager::GetInstance()); |
| 600 } |
593 } | 601 } |
594 | 602 |
595 if (!parsed_command_line_.HasSwitch( | 603 if (!parsed_command_line_.HasSwitch( |
596 switches::kDisableScreenOrientationLock)) { | 604 switches::kDisableScreenOrientationLock)) { |
597 TRACE_EVENT0("startup", | 605 TRACE_EVENT0("startup", |
598 "BrowserMainLoop::Subsystem:ScreenOrientationProvider"); | 606 "BrowserMainLoop::Subsystem:ScreenOrientationProvider"); |
599 screen_orientation_delegate_.reset( | 607 screen_orientation_delegate_.reset( |
600 new ScreenOrientationDelegateAndroid()); | 608 new ScreenOrientationDelegateAndroid()); |
601 ScreenOrientationProvider::SetDelegate(screen_orientation_delegate_.get()); | 609 ScreenOrientationProvider::SetDelegate(screen_orientation_delegate_.get()); |
602 } | 610 } |
603 #endif | 611 #endif |
604 | 612 |
605 #if defined(OS_MACOSX) && !defined(OS_IOS) | 613 #if defined(OS_MACOSX) && !defined(OS_IOS) |
606 { | 614 { |
607 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:IOSurfaceManager"); | 615 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:IOSurfaceManager"); |
608 IOSurfaceManager::SetInstance(BrowserIOSurfaceManager::GetInstance()); | 616 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) { |
| 617 IOSurfaceManager::SetInstance(InProcessIOSurfaceManager::GetInstance()); |
| 618 } else { |
| 619 IOSurfaceManager::SetInstance(BrowserIOSurfaceManager::GetInstance()); |
| 620 } |
609 } | 621 } |
610 #endif | 622 #endif |
611 | 623 |
612 if (parsed_command_line_.HasSwitch(switches::kMemoryMetrics)) { | 624 if (parsed_command_line_.HasSwitch(switches::kMemoryMetrics)) { |
613 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:MemoryObserver"); | 625 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:MemoryObserver"); |
614 memory_observer_.reset(new MemoryObserver()); | 626 memory_observer_.reset(new MemoryObserver()); |
615 base::MessageLoop::current()->AddTaskObserver(memory_observer_.get()); | 627 base::MessageLoop::current()->AddTaskObserver(memory_observer_.get()); |
616 } | 628 } |
617 | 629 |
618 if (parsed_command_line_.HasSwitch( | 630 if (parsed_command_line_.HasSwitch( |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 DCHECK(is_tracing_startup_); | 1380 DCHECK(is_tracing_startup_); |
1369 | 1381 |
1370 is_tracing_startup_ = false; | 1382 is_tracing_startup_ = false; |
1371 TracingController::GetInstance()->DisableRecording( | 1383 TracingController::GetInstance()->DisableRecording( |
1372 TracingController::CreateFileSink( | 1384 TracingController::CreateFileSink( |
1373 startup_trace_file_, | 1385 startup_trace_file_, |
1374 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1386 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
1375 } | 1387 } |
1376 | 1388 |
1377 } // namespace content | 1389 } // namespace content |
OLD | NEW |