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

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

Issue 2124633002: Add new gpu driver bug workaround DISABLE_TRANSPARENT_VISUALS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and addressed remarks from tapted Created 4 years, 5 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 #if defined(ENABLE_PLUGINS) 172 #if defined(ENABLE_PLUGINS)
173 #include "content/browser/plugin_service_impl.h" 173 #include "content/browser/plugin_service_impl.h"
174 #endif 174 #endif
175 175
176 #if defined(ENABLE_MOJO_CDM) && defined(ENABLE_PEPPER_CDMS) 176 #if defined(ENABLE_MOJO_CDM) && defined(ENABLE_PEPPER_CDMS)
177 #include "content/browser/media/cdm_service_impl.h" 177 #include "content/browser/media/cdm_service_impl.h"
178 #endif 178 #endif
179 179
180 #if defined(USE_X11) 180 #if defined(USE_X11)
181 #include "gpu/config/gpu_driver_bug_workaround_type.h"
181 #include "ui/base/x/x11_util_internal.h" // nogncheck 182 #include "ui/base/x/x11_util_internal.h" // nogncheck
182 #include "ui/gfx/x/x11_connection.h" // nogncheck 183 #include "ui/gfx/x/x11_connection.h" // nogncheck
183 #include "ui/gfx/x/x11_switches.h" // nogncheck 184 #include "ui/gfx/x/x11_switches.h" // nogncheck
184 #include "ui/gfx/x/x11_types.h" // nogncheck 185 #include "ui/gfx/x/x11_types.h" // nogncheck
185 #endif 186 #endif
186 187
187 #if defined(USE_NSS_CERTS) 188 #if defined(USE_NSS_CERTS)
188 #include "crypto/nss_util.h" 189 #include "crypto/nss_util.h"
189 #endif 190 #endif
190 191
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 // starts ensures the affected IO thread messages always have somewhere to go. 746 // starts ensures the affected IO thread messages always have somewhere to go.
746 ui::WindowResizeHelperMac::Get()->Init(base::ThreadTaskRunnerHandle::Get()); 747 ui::WindowResizeHelperMac::Get()->Init(base::ThreadTaskRunnerHandle::Get());
747 #endif 748 #endif
748 749
749 // 1) Need to initialize in-process GpuDataManager before creating threads. 750 // 1) Need to initialize in-process GpuDataManager before creating threads.
750 // It's unsafe to append the gpu command line switches to the global 751 // It's unsafe to append the gpu command line switches to the global
751 // CommandLine::ForCurrentProcess object after threads are created. 752 // CommandLine::ForCurrentProcess object after threads are created.
752 // 2) Must be after parts_->PreCreateThreads to pick up chrome://flags. 753 // 2) Must be after parts_->PreCreateThreads to pick up chrome://flags.
753 GpuDataManagerImpl::GetInstance()->Initialize(); 754 GpuDataManagerImpl::GetInstance()->Initialize();
754 755
756 #if defined(USE_X11) && !defined(OS_CHROMEOS)
757 // PreCreateThreads is called before CreateStartupTasks which starts the gpu
758 // process.
759 bool enable_transparent_visuals =
760 !GpuDataManagerImpl::GetInstance()->IsDriverBugWorkaroundActive(
761 gpu::DISABLE_TRANSPARENT_VISUALS);
762 Visual* visual = NULL;
763 int depth = 0;
764 ui::ChooseVisualForWindow(enable_transparent_visuals, &visual, &depth);
765 DCHECK(depth > 0);
766 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
767 switches::kWindowDepth, base::IntToString(depth));
768 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
769 switches::kX11VisualID, base::UintToString(visual->visualid));
770 #endif
771
755 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_ANDROID) 772 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_ANDROID)
756 // Single-process is an unsupported and not fully tested mode, so 773 // Single-process is an unsupported and not fully tested mode, so
757 // don't enable it for official Chrome builds (except on Android). 774 // don't enable it for official Chrome builds (except on Android).
758 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) 775 if (parsed_command_line_.HasSwitch(switches::kSingleProcess))
759 RenderProcessHost::SetRunRendererInProcess(true); 776 RenderProcessHost::SetRunRendererInProcess(true);
760 #endif 777 #endif
761 778
762 return result_code_; 779 return result_code_;
763 } 780 }
764 781
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 PLOG(FATAL); 1389 PLOG(FATAL);
1373 #endif 1390 #endif
1374 1391
1375 #if defined(USE_AURA) 1392 #if defined(USE_AURA)
1376 1393
1377 #if defined(USE_X11) 1394 #if defined(USE_X11)
1378 if (!gfx::GetXDisplay()) { 1395 if (!gfx::GetXDisplay()) {
1379 LOG(ERROR) << "Unable to open X display."; 1396 LOG(ERROR) << "Unable to open X display.";
1380 return false; 1397 return false;
1381 } 1398 }
1382
1383 #if !defined(OS_CHROMEOS)
1384 // InitializeToolkit is called before CreateStartupTasks which one starts the
1385 // gpu process.
1386 Visual* visual = NULL;
1387 int depth = 0;
1388 ui::ChooseVisualForWindow(&visual, &depth);
1389 DCHECK(depth > 0);
1390 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
1391 switches::kWindowDepth, base::IntToString(depth));
1392 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
1393 switches::kX11VisualID, base::UintToString(visual->visualid));
1394 #endif
1395
1396 #endif 1399 #endif
1397 1400
1398 // Env creates the compositor. Aura widgets need the compositor to be created 1401 // Env creates the compositor. Aura widgets need the compositor to be created
1399 // before they can be initialized by the browser. 1402 // before they can be initialized by the browser.
1400 env_ = aura::Env::CreateInstance(); 1403 env_ = aura::Env::CreateInstance();
1401 #endif // defined(USE_AURA) 1404 #endif // defined(USE_AURA)
1402 1405
1403 if (parts_) 1406 if (parts_)
1404 parts_->ToolkitInitialized(); 1407 parts_->ToolkitInitialized();
1405 1408
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = 1515 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner =
1513 audio_thread_->task_runner(); 1516 audio_thread_->task_runner();
1514 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), 1517 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner),
1515 std::move(worker_task_runner), 1518 std::move(worker_task_runner),
1516 MediaInternals::GetInstance()); 1519 MediaInternals::GetInstance());
1517 } 1520 }
1518 CHECK(audio_manager_); 1521 CHECK(audio_manager_);
1519 } 1522 }
1520 1523
1521 } // namespace content 1524 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698