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