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

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

Issue 1991953002: Implement a runtime headless mode for Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 explicit GpuDataManagerVisualProxy(GpuDataManagerImpl* gpu_data_manager) 387 explicit GpuDataManagerVisualProxy(GpuDataManagerImpl* gpu_data_manager)
388 : gpu_data_manager_(gpu_data_manager) { 388 : gpu_data_manager_(gpu_data_manager) {
389 gpu_data_manager_->AddObserver(this); 389 gpu_data_manager_->AddObserver(this);
390 } 390 }
391 391
392 ~GpuDataManagerVisualProxy() override { 392 ~GpuDataManagerVisualProxy() override {
393 gpu_data_manager_->RemoveObserver(this); 393 gpu_data_manager_->RemoveObserver(this);
394 } 394 }
395 395
396 void OnGpuInfoUpdate() override { 396 void OnGpuInfoUpdate() override {
397 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless))
398 return;
397 gpu::GPUInfo gpu_info = gpu_data_manager_->GetGPUInfo(); 399 gpu::GPUInfo gpu_info = gpu_data_manager_->GetGPUInfo();
398 if (!ui::XVisualManager::GetInstance()->OnGPUInfoChanged( 400 if (!ui::XVisualManager::GetInstance()->OnGPUInfoChanged(
399 gpu_info.software_rendering || 401 gpu_info.software_rendering ||
400 !gpu_data_manager_->GpuAccessAllowed(nullptr), 402 !gpu_data_manager_->GpuAccessAllowed(nullptr),
401 gpu_info.system_visual, gpu_info.rgba_visual)) { 403 gpu_info.system_visual, gpu_info.rgba_visual)) {
402 // The GPU process sent back bad visuals, which should never happen. 404 // The GPU process sent back bad visuals, which should never happen.
403 auto* gpu_process_host = GpuProcessHost::Get( 405 auto* gpu_process_host = GpuProcessHost::Get(
404 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, false); 406 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, false);
405 if (gpu_process_host) 407 if (gpu_process_host)
406 gpu_process_host->ForceShutdown(); 408 gpu_process_host->ForceShutdown();
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 INITCOMMONCONTROLSEX config; 1474 INITCOMMONCONTROLSEX config;
1473 config.dwSize = sizeof(config); 1475 config.dwSize = sizeof(config);
1474 config.dwICC = ICC_WIN95_CLASSES; 1476 config.dwICC = ICC_WIN95_CLASSES;
1475 if (!InitCommonControlsEx(&config)) 1477 if (!InitCommonControlsEx(&config))
1476 PLOG(FATAL); 1478 PLOG(FATAL);
1477 #endif 1479 #endif
1478 1480
1479 #if defined(USE_AURA) 1481 #if defined(USE_AURA)
1480 1482
1481 #if defined(USE_X11) 1483 #if defined(USE_X11)
1482 if (!gfx::GetXDisplay()) { 1484 if (!parsed_command_line_.HasSwitch(switches::kHeadless) &&
1485 !gfx::GetXDisplay()) {
1483 LOG(ERROR) << "Unable to open X display."; 1486 LOG(ERROR) << "Unable to open X display.";
1484 return false; 1487 return false;
1485 } 1488 }
1486 #endif 1489 #endif
1487 1490
1488 // Env creates the compositor. Aura widgets need the compositor to be created 1491 // Env creates the compositor. Aura widgets need the compositor to be created
1489 // before they can be initialized by the browser. 1492 // before they can be initialized by the browser.
1490 env_ = aura::Env::CreateInstance(); 1493 env_ = aura::Env::CreateInstance();
1491 #endif // defined(USE_AURA) 1494 #endif // defined(USE_AURA)
1492 1495
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = 1629 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner =
1627 audio_thread_->task_runner(); 1630 audio_thread_->task_runner();
1628 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), 1631 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner),
1629 std::move(worker_task_runner), 1632 std::move(worker_task_runner),
1630 MediaInternals::GetInstance()); 1633 MediaInternals::GetInstance());
1631 } 1634 }
1632 CHECK(audio_manager_); 1635 CHECK(audio_manager_);
1633 } 1636 }
1634 1637
1635 } // namespace content 1638 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698