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

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 135213003: Ensure GL initialization only happens once, and provide common init path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: initgl: compile3 Created 6 years, 10 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 | Annotate | Revision Log
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 "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/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 #include "ui/base/clipboard/clipboard.h" 63 #include "ui/base/clipboard/clipboard.h"
64 64
65 #if defined(USE_AURA) 65 #if defined(USE_AURA)
66 #include "content/browser/compositor/image_transport_factory.h" 66 #include "content/browser/compositor/image_transport_factory.h"
67 #endif 67 #endif
68 68
69 #if defined(OS_ANDROID) 69 #if defined(OS_ANDROID)
70 #include "base/android/jni_android.h" 70 #include "base/android/jni_android.h"
71 #include "content/browser/android/browser_startup_controller.h" 71 #include "content/browser/android/browser_startup_controller.h"
72 #include "content/browser/android/surface_texture_peer_browser_impl.h" 72 #include "content/browser/android/surface_texture_peer_browser_impl.h"
73 #include "ui/gl/gl_surface.h"
73 #endif 74 #endif
74 75
75 #if defined(OS_MACOSX) && !defined(OS_IOS) 76 #if defined(OS_MACOSX) && !defined(OS_IOS)
76 #include "content/browser/theme_helper_mac.h" 77 #include "content/browser/theme_helper_mac.h"
77 #endif 78 #endif
78 79
79 #if defined(OS_WIN) 80 #if defined(OS_WIN)
80 #include <windows.h> 81 #include <windows.h>
81 #include <commctrl.h> 82 #include <commctrl.h>
82 #include <shellapi.h> 83 #include <shellapi.h>
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 // (this thread is UI thread, and io_thread_ is for IPCs). 941 // (this thread is UI thread, and io_thread_ is for IPCs).
941 io_thread_->SetPriority(base::kThreadPriority_Display); 942 io_thread_->SetPriority(base::kThreadPriority_Display);
942 base::PlatformThread::SetThreadPriority( 943 base::PlatformThread::SetThreadPriority(
943 base::PlatformThread::CurrentHandle(), 944 base::PlatformThread::CurrentHandle(),
944 base::kThreadPriority_Display); 945 base::kThreadPriority_Display);
945 #endif 946 #endif
946 947
947 #if !defined(OS_IOS) 948 #if !defined(OS_IOS)
948 HistogramSynchronizer::GetInstance(); 949 HistogramSynchronizer::GetInstance();
949 950
951 #if defined(OS_ANDROID)
952 // On Android, GLSurface::InitializeOneOff() must be called before initalizing
953 // the GpuDataManagerImpl as it uses the GL bindings. crbug.com/326295
954 if (!gfx::GLSurface::InitializeOneOff())
955 LOG(FATAL) << "GLSurface::InitializeOneOff failed";
956 #endif
957
950 // Initialize the GpuDataManager before we set up the MessageLoops because 958 // Initialize the GpuDataManager before we set up the MessageLoops because
951 // otherwise we'll trigger the assertion about doing IO on the UI thread. 959 // otherwise we'll trigger the assertion about doing IO on the UI thread.
952 GpuDataManagerImpl::GetInstance()->Initialize(); 960 GpuDataManagerImpl::GetInstance()->Initialize();
953 961
954 bool always_uses_gpu = IsForceCompositingModeEnabled(); 962 bool always_uses_gpu = IsForceCompositingModeEnabled();
955 bool established_gpu_channel = false; 963 bool established_gpu_channel = false;
956 #if defined(USE_AURA) || defined(OS_ANDROID) 964 #if defined(USE_AURA) || defined(OS_ANDROID)
957 established_gpu_channel = 965 established_gpu_channel =
958 !parsed_command_line_.HasSwitch(switches::kDisableGpuProcessPrelaunch) || 966 !parsed_command_line_.HasSwitch(switches::kDisableGpuProcessPrelaunch) ||
959 parsed_command_line_.HasSwitch(switches::kSingleProcess) || 967 parsed_command_line_.HasSwitch(switches::kSingleProcess) ||
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 base::TimeDelta::FromSeconds(delay_secs)); 1125 base::TimeDelta::FromSeconds(delay_secs));
1118 } 1126 }
1119 1127
1120 void BrowserMainLoop::EndStartupTracing(const base::FilePath& trace_file) { 1128 void BrowserMainLoop::EndStartupTracing(const base::FilePath& trace_file) {
1121 is_tracing_startup_ = false; 1129 is_tracing_startup_ = false;
1122 TracingController::GetInstance()->DisableRecording( 1130 TracingController::GetInstance()->DisableRecording(
1123 trace_file, TracingController::TracingFileResultCallback()); 1131 trace_file, TracingController::TracingFileResultCallback());
1124 } 1132 }
1125 1133
1126 } // namespace content 1134 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698