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