diff options
Diffstat (limited to 'chromium')
9 files changed, 28 insertions, 16 deletions
diff --git a/chromium/content/browser/browser_main_loop.cc b/chromium/content/browser/browser_main_loop.cc index 699788d1fed..b408b7914c4 100644 --- a/chromium/content/browser/browser_main_loop.cc +++ b/chromium/content/browser/browser_main_loop.cc @@ -500,7 +500,7 @@ class GpuDataManagerVisualProxy : public GpuDataManagerObserver { } void OnGpuInfoUpdate() override { - if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless)) + if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless) || !gfx::GetXDisplay()) return; gpu::GPUInfo gpu_info = gpu_data_manager_->GetGPUInfo(); if (!ui::XVisualManager::GetInstance()->OnGPUInfoChanged( @@ -582,7 +582,7 @@ void BrowserMainLoop::EarlyInitialization() { SetupSandbox(parsed_command_line_); #endif -#if defined(USE_X11) +#if defined(USE_X11) && !defined(TOOLKIT_QT) if (UsingInProcessGpu()) { if (!gfx::InitializeThreadedX11()) { LOG(ERROR) << "Failed to put Xlib into threaded mode."; @@ -1655,7 +1655,7 @@ bool BrowserMainLoop::InitializeToolkit() { #if defined(USE_AURA) -#if defined(USE_X11) +#if defined(USE_X11) && !defined(TOOLKIT_QT) if (!parsed_command_line_.HasSwitch(switches::kHeadless) && !gfx::GetXDisplay()) { LOG(ERROR) << "Unable to open X display."; diff --git a/chromium/content/browser/gpu/gpu_internals_ui.cc b/chromium/content/browser/gpu/gpu_internals_ui.cc index 73a2bf310c9..155513dfb9e 100644 --- a/chromium/content/browser/gpu/gpu_internals_ui.cc +++ b/chromium/content/browser/gpu/gpu_internals_ui.cc @@ -210,9 +210,9 @@ std::unique_ptr<base::DictionaryValue> GpuInfoAsDictionaryValue() { basic_info->Append(NewDescriptionValuePair("Window system binding extensions", gpu_info.gl_ws_extensions)); #if defined(OS_LINUX) && defined(USE_X11) - basic_info->Append(NewDescriptionValuePair("Window manager", - ui::GuessWindowManagerName())); - { + if (gfx::GetXDisplay()) { + basic_info->Append(NewDescriptionValuePair("Window manager", + ui::GuessWindowManagerName())); std::unique_ptr<base::Environment> env(base::Environment::Create()); std::string value; const char kXDGCurrentDesktop[] = "XDG_CURRENT_DESKTOP"; @@ -249,10 +249,12 @@ std::unique_ptr<base::DictionaryValue> GpuInfoAsDictionaryValue() { #endif #if defined(USE_X11) - basic_info->Append(NewDescriptionValuePair( - "System visual ID", base::Uint64ToString(gpu_info.system_visual))); - basic_info->Append(NewDescriptionValuePair( - "RGBA visual ID", base::Uint64ToString(gpu_info.rgba_visual))); + if (gfx::GetXDisplay()) { + basic_info->Append(NewDescriptionValuePair( + "System visual ID", base::Uint64ToString(gpu_info.system_visual))); + basic_info->Append(NewDescriptionValuePair( + "RGBA visual ID", base::Uint64ToString(gpu_info.rgba_visual))); + } #endif info->Set("basic_info", std::move(basic_info)); diff --git a/chromium/content/gpu/gpu_main.cc b/chromium/content/gpu/gpu_main.cc index 556cf00e8ac..4015963ae1b 100644 --- a/chromium/content/gpu/gpu_main.cc +++ b/chromium/content/gpu/gpu_main.cc @@ -226,9 +226,11 @@ int GpuMain(const MainFunctionParams& parameters) { #elif defined(USE_X11) // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX // and https://crbug.com/326995. +#if !defined(TOOLKIT_QT) ui::SetDefaultX11ErrorHandlers(); if (!gfx::GetXDisplay()) return RESULT_CODE_GPU_DEAD_ON_ARRIVAL; +#endif main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); event_source = ui::PlatformEventSource::CreateDefault(); #elif defined(USE_OZONE) diff --git a/chromium/services/device/wake_lock/power_save_blocker/power_save_blocker_x11.cc b/chromium/services/device/wake_lock/power_save_blocker/power_save_blocker_x11.cc index 8fd9a5ae7cf..7df37d99862 100644 --- a/chromium/services/device/wake_lock/power_save_blocker/power_save_blocker_x11.cc +++ b/chromium/services/device/wake_lock/power_save_blocker/power_save_blocker_x11.cc @@ -433,7 +433,7 @@ bool PowerSaveBlocker::Delegate::DPMSEnabled() { XDisplay* display = gfx::GetXDisplay(); BOOL enabled = false; int dummy; - if (DPMSQueryExtension(display, &dummy, &dummy) && DPMSCapable(display)) { + if (display && DPMSQueryExtension(display, &dummy, &dummy) && DPMSCapable(display)) { CARD16 state; DPMSInfo(display, &state, &enabled); } @@ -451,6 +451,9 @@ bool PowerSaveBlocker::Delegate::XSSAvailable() { int major; int minor; + if (!display) + return false; + if (!XScreenSaverQueryExtension(display, &dummy, &dummy)) return false; diff --git a/chromium/third_party/angle/src/gpu_info_util/SystemInfo_x11.cpp b/chromium/third_party/angle/src/gpu_info_util/SystemInfo_x11.cpp index 3513309f36a..792305f5503 100644 --- a/chromium/third_party/angle/src/gpu_info_util/SystemInfo_x11.cpp +++ b/chromium/third_party/angle/src/gpu_info_util/SystemInfo_x11.cpp @@ -30,7 +30,7 @@ bool GetNvidiaDriverVersionWithXNVCtrl(std::string *version) Display *display = XOpenDisplay(nullptr); - if (XNVCTRLQueryExtension(display, &eventBase, &errorBase)) + if (display && XNVCTRLQueryExtension(display, &eventBase, &errorBase)) { int screenCount = ScreenCount(display); for (int screen = 0; screen < screenCount; ++screen) diff --git a/chromium/ui/base/x/x11_util.cc b/chromium/ui/base/x/x11_util.cc index dbb8cc534e3..9a5b4095694 100644 --- a/chromium/ui/base/x/x11_util.cc +++ b/chromium/ui/base/x/x11_util.cc @@ -147,6 +147,9 @@ bool SupportsEWMH() { bool GetWindowManagerName(std::string* wm_name) { DCHECK(wm_name); + if (!gfx::GetXDisplay()) + return false; + if (!SupportsEWMH()) return false; diff --git a/chromium/ui/display/util/x11/edid_parser_x11.cc b/chromium/ui/display/util/x11/edid_parser_x11.cc index 4c5f68298ae..954e55c2442 100644 --- a/chromium/ui/display/util/x11/edid_parser_x11.cc +++ b/chromium/ui/display/util/x11/edid_parser_x11.cc @@ -29,10 +29,12 @@ bool IsRandRAvailable() { // Returns true if EDID property is successfully obtained. Otherwise returns // false and does not touch |edid|. bool GetEDIDProperty(XID output, std::vector<uint8_t>* edid) { - if (!IsRandRAvailable()) + Display* display = gfx::GetXDisplay(); + if (!display) return false; - Display* display = gfx::GetXDisplay(); + if (!IsRandRAvailable()) + return false; Atom edid_property = gfx::GetAtom(RR_PROPERTY_RANDR_EDID); diff --git a/chromium/ui/events/platform/x11/x11_event_source_libevent.cc b/chromium/ui/events/platform/x11/x11_event_source_libevent.cc index aaebde42449..e6236d08a90 100644 --- a/chromium/ui/events/platform/x11/x11_event_source_libevent.cc +++ b/chromium/ui/events/platform/x11/x11_event_source_libevent.cc @@ -216,7 +216,7 @@ void X11EventSourceLibevent::OnFileCanWriteWithoutBlocking(int fd) { NOTREACHED(); } -#if defined(USE_X11) +#if defined(USE_X11) && !defined(TOOLKIT_QT) std::unique_ptr<PlatformEventSource> PlatformEventSource::CreateDefault() { return base::MakeUnique<X11EventSourceLibevent>(gfx::GetXDisplay()); } diff --git a/chromium/ui/views/widget/desktop_aura/desktop_screen_x11.cc b/chromium/ui/views/widget/desktop_aura/desktop_screen_x11.cc index 55ffb43ee48..b1ed42dee9d 100644 --- a/chromium/ui/views/widget/desktop_aura/desktop_screen_x11.cc +++ b/chromium/ui/views/widget/desktop_aura/desktop_screen_x11.cc @@ -44,7 +44,7 @@ namespace { // static gfx::ICCProfile GetICCProfileFromBestMonitor() { gfx::ICCProfile icc_profile; - if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless)) + if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless) || !gfx::GetXDisplay()) return icc_profile; Atom property = gfx::GetAtom("_ICC_PROFILE"); if (property != None) { |