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

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: rebase 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 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 // (this thread is UI thread, and io_thread_ is for IPCs). 937 // (this thread is UI thread, and io_thread_ is for IPCs).
937 io_thread_->SetPriority(base::kThreadPriority_Display); 938 io_thread_->SetPriority(base::kThreadPriority_Display);
938 base::PlatformThread::SetThreadPriority( 939 base::PlatformThread::SetThreadPriority(
939 base::PlatformThread::CurrentHandle(), 940 base::PlatformThread::CurrentHandle(),
940 base::kThreadPriority_Display); 941 base::kThreadPriority_Display);
941 #endif 942 #endif
942 943
943 #if !defined(OS_IOS) 944 #if !defined(OS_IOS)
944 HistogramSynchronizer::GetInstance(); 945 HistogramSynchronizer::GetInstance();
945 946
947 #if defined(OS_ANDROID)
948 // On Android, GLSurface::InitializeOneOff() must be called before initalizing
949 // the GpuDataManagerImpl as it uses the GL bindings. crbug.com/326295
950 if (!gfx::GLSurface::InitializeOneOff())
951 LOG(FATAL) << "GLSurface::InitializeOneOff failed";
952 #endif
953
946 // Initialize the GpuDataManager before we set up the MessageLoops because 954 // Initialize the GpuDataManager before we set up the MessageLoops because
947 // otherwise we'll trigger the assertion about doing IO on the UI thread. 955 // otherwise we'll trigger the assertion about doing IO on the UI thread.
948 GpuDataManagerImpl::GetInstance()->Initialize(); 956 GpuDataManagerImpl::GetInstance()->Initialize();
949 957
950 bool always_uses_gpu = IsForceCompositingModeEnabled(); 958 bool always_uses_gpu = IsForceCompositingModeEnabled();
951 bool established_gpu_channel = false; 959 bool established_gpu_channel = false;
952 #if defined(USE_AURA) || defined(OS_ANDROID) 960 #if defined(USE_AURA) || defined(OS_ANDROID)
953 established_gpu_channel = 961 established_gpu_channel =
954 !parsed_command_line_.HasSwitch(switches::kDisableGpuProcessPrelaunch) || 962 !parsed_command_line_.HasSwitch(switches::kDisableGpuProcessPrelaunch) ||
955 parsed_command_line_.HasSwitch(switches::kSingleProcess) || 963 parsed_command_line_.HasSwitch(switches::kSingleProcess) ||
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 base::TimeDelta::FromSeconds(delay_secs)); 1121 base::TimeDelta::FromSeconds(delay_secs));
1114 } 1122 }
1115 1123
1116 void BrowserMainLoop::EndStartupTracing(const base::FilePath& trace_file) { 1124 void BrowserMainLoop::EndStartupTracing(const base::FilePath& trace_file) {
1117 is_tracing_startup_ = false; 1125 is_tracing_startup_ = false;
1118 TracingController::GetInstance()->DisableRecording( 1126 TracingController::GetInstance()->DisableRecording(
1119 trace_file, TracingController::TracingFileResultCallback()); 1127 trace_file, TracingController::TracingFileResultCallback());
1120 } 1128 }
1121 1129
1122 } // namespace content 1130 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698