| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 #if defined(ENABLE_PLUGINS) | 175 #if defined(ENABLE_PLUGINS) |
| 176 #include "content/browser/plugin_service_impl.h" | 176 #include "content/browser/plugin_service_impl.h" |
| 177 #endif | 177 #endif |
| 178 | 178 |
| 179 #if defined(ENABLE_MOJO_CDM) && defined(ENABLE_PEPPER_CDMS) | 179 #if defined(ENABLE_MOJO_CDM) && defined(ENABLE_PEPPER_CDMS) |
| 180 #include "content/browser/media/cdm_service_impl.h" | 180 #include "content/browser/media/cdm_service_impl.h" |
| 181 #endif | 181 #endif |
| 182 | 182 |
| 183 #if defined(USE_X11) | 183 #if defined(USE_X11) |
| 184 #include "gpu/config/gpu_driver_bug_workaround_type.h" |
| 184 #include "ui/base/x/x11_util_internal.h" // nogncheck | 185 #include "ui/base/x/x11_util_internal.h" // nogncheck |
| 185 #include "ui/gfx/x/x11_connection.h" // nogncheck | 186 #include "ui/gfx/x/x11_connection.h" // nogncheck |
| 186 #include "ui/gfx/x/x11_switches.h" // nogncheck | 187 #include "ui/gfx/x/x11_switches.h" // nogncheck |
| 187 #include "ui/gfx/x/x11_types.h" // nogncheck | 188 #include "ui/gfx/x/x11_types.h" // nogncheck |
| 188 #endif | 189 #endif |
| 189 | 190 |
| 190 #if defined(USE_NSS_CERTS) | 191 #if defined(USE_NSS_CERTS) |
| 191 #include "crypto/nss_util.h" | 192 #include "crypto/nss_util.h" |
| 192 #endif | 193 #endif |
| 193 | 194 |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 // starts ensures the affected IO thread messages always have somewhere to go. | 756 // starts ensures the affected IO thread messages always have somewhere to go. |
| 756 ui::WindowResizeHelperMac::Get()->Init(base::ThreadTaskRunnerHandle::Get()); | 757 ui::WindowResizeHelperMac::Get()->Init(base::ThreadTaskRunnerHandle::Get()); |
| 757 #endif | 758 #endif |
| 758 | 759 |
| 759 // 1) Need to initialize in-process GpuDataManager before creating threads. | 760 // 1) Need to initialize in-process GpuDataManager before creating threads. |
| 760 // It's unsafe to append the gpu command line switches to the global | 761 // It's unsafe to append the gpu command line switches to the global |
| 761 // CommandLine::ForCurrentProcess object after threads are created. | 762 // CommandLine::ForCurrentProcess object after threads are created. |
| 762 // 2) Must be after parts_->PreCreateThreads to pick up chrome://flags. | 763 // 2) Must be after parts_->PreCreateThreads to pick up chrome://flags. |
| 763 GpuDataManagerImpl::GetInstance()->Initialize(); | 764 GpuDataManagerImpl::GetInstance()->Initialize(); |
| 764 | 765 |
| 766 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
| 767 // PreCreateThreads is called before CreateStartupTasks which starts the gpu |
| 768 // process. |
| 769 bool enable_transparent_visuals = |
| 770 !GpuDataManagerImpl::GetInstance()->IsDriverBugWorkaroundActive( |
| 771 gpu::DISABLE_TRANSPARENT_VISUALS); |
| 772 Visual* visual = NULL; |
| 773 int depth = 0; |
| 774 ui::ChooseVisualForWindow(enable_transparent_visuals, &visual, &depth); |
| 775 DCHECK(depth > 0); |
| 776 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 777 switches::kWindowDepth, base::IntToString(depth)); |
| 778 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 779 switches::kX11VisualID, base::UintToString(visual->visualid)); |
| 780 #endif |
| 781 |
| 765 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_ANDROID) | 782 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_ANDROID) |
| 766 // Single-process is an unsupported and not fully tested mode, so | 783 // Single-process is an unsupported and not fully tested mode, so |
| 767 // don't enable it for official Chrome builds (except on Android). | 784 // don't enable it for official Chrome builds (except on Android). |
| 768 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) | 785 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) |
| 769 RenderProcessHost::SetRunRendererInProcess(true); | 786 RenderProcessHost::SetRunRendererInProcess(true); |
| 770 #endif | 787 #endif |
| 771 | 788 |
| 772 return result_code_; | 789 return result_code_; |
| 773 } | 790 } |
| 774 | 791 |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1378 PLOG(FATAL); | 1395 PLOG(FATAL); |
| 1379 #endif | 1396 #endif |
| 1380 | 1397 |
| 1381 #if defined(USE_AURA) | 1398 #if defined(USE_AURA) |
| 1382 | 1399 |
| 1383 #if defined(USE_X11) | 1400 #if defined(USE_X11) |
| 1384 if (!gfx::GetXDisplay()) { | 1401 if (!gfx::GetXDisplay()) { |
| 1385 LOG(ERROR) << "Unable to open X display."; | 1402 LOG(ERROR) << "Unable to open X display."; |
| 1386 return false; | 1403 return false; |
| 1387 } | 1404 } |
| 1388 | |
| 1389 #if !defined(OS_CHROMEOS) | |
| 1390 // InitializeToolkit is called before CreateStartupTasks which one starts the | |
| 1391 // gpu process. | |
| 1392 Visual* visual = NULL; | |
| 1393 int depth = 0; | |
| 1394 ui::ChooseVisualForWindow(&visual, &depth); | |
| 1395 DCHECK(depth > 0); | |
| 1396 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | |
| 1397 switches::kWindowDepth, base::IntToString(depth)); | |
| 1398 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | |
| 1399 switches::kX11VisualID, base::UintToString(visual->visualid)); | |
| 1400 #endif | |
| 1401 | |
| 1402 #endif | 1405 #endif |
| 1403 | 1406 |
| 1404 // Env creates the compositor. Aura widgets need the compositor to be created | 1407 // Env creates the compositor. Aura widgets need the compositor to be created |
| 1405 // before they can be initialized by the browser. | 1408 // before they can be initialized by the browser. |
| 1406 env_ = aura::Env::CreateInstance(); | 1409 env_ = aura::Env::CreateInstance(); |
| 1407 #endif // defined(USE_AURA) | 1410 #endif // defined(USE_AURA) |
| 1408 | 1411 |
| 1409 if (parts_) | 1412 if (parts_) |
| 1410 parts_->ToolkitInitialized(); | 1413 parts_->ToolkitInitialized(); |
| 1411 | 1414 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = | 1521 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = |
| 1519 audio_thread_->task_runner(); | 1522 audio_thread_->task_runner(); |
| 1520 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), | 1523 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), |
| 1521 std::move(worker_task_runner), | 1524 std::move(worker_task_runner), |
| 1522 MediaInternals::GetInstance()); | 1525 MediaInternals::GetInstance()); |
| 1523 } | 1526 } |
| 1524 CHECK(audio_manager_); | 1527 CHECK(audio_manager_); |
| 1525 } | 1528 } |
| 1526 | 1529 |
| 1527 } // namespace content | 1530 } // namespace content |
| OLD | NEW |