Commit 837569dd authored by Sadrul Habib Chowdhury's avatar Sadrul Habib Chowdhury Committed by Commit Bot

viz: Remove BrowserThread dependency from viz.

The SoftwareOutputDevice implementations in various platforms only have
a dependency on content for BrowserThread. Replace that dependency with
a ThreadChecker instead.

BUG=...

Change-Id: I58b9569276b9a9edcb57ba378b4ab52229345bf3
Reviewed-on: https://chromium-review.googlesource.com/721893Reviewed-by: default avatardanakj <danakj@chromium.org>
Commit-Queue: Sadrul Chowdhury <sadrul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#509409}
parent 315bc919
...@@ -288,6 +288,7 @@ GpuProcessTransportFactory::CreateSoftwareOutputDevice( ...@@ -288,6 +288,7 @@ GpuProcessTransportFactory::CreateSoftwareOutputDevice(
} }
#endif #endif
DCHECK_CURRENTLY_ON(BrowserThread::UI);
#if defined(OS_WIN) #if defined(OS_WIN)
return std::make_unique<SoftwareOutputDeviceWin>(software_backing_.get(), return std::make_unique<SoftwareOutputDeviceWin>(software_backing_.get(),
widget); widget);
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "base/debug/alias.h" #include "base/debug/alias.h"
#include "base/memory/shared_memory.h" #include "base/memory/shared_memory.h"
#include "components/viz/common/quads/shared_bitmap.h" #include "components/viz/common/quads/shared_bitmap.h"
#include "content/public/browser/browser_thread.h"
#include "skia/ext/platform_canvas.h" #include "skia/ext/platform_canvas.h"
#include "skia/ext/skia_utils_win.h" #include "skia/ext/skia_utils_win.h"
#include "ui/base/win/internal_constants.h" #include "ui/base/win/internal_constants.h"
...@@ -91,8 +90,6 @@ SoftwareOutputDeviceWin::SoftwareOutputDeviceWin(OutputDeviceBacking* backing, ...@@ -91,8 +90,6 @@ SoftwareOutputDeviceWin::SoftwareOutputDeviceWin(OutputDeviceBacking* backing,
is_hwnd_composited_(false), is_hwnd_composited_(false),
backing_(backing), backing_(backing),
in_paint_(false) { in_paint_(false) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
is_hwnd_composited_ = !!::GetProp(hwnd_, ui::kWindowTranslucent); is_hwnd_composited_ = !!::GetProp(hwnd_, ui::kWindowTranslucent);
// Layered windows must be completely updated every time, so they can't // Layered windows must be completely updated every time, so they can't
// share contents with other windows. // share contents with other windows.
...@@ -103,7 +100,7 @@ SoftwareOutputDeviceWin::SoftwareOutputDeviceWin(OutputDeviceBacking* backing, ...@@ -103,7 +100,7 @@ SoftwareOutputDeviceWin::SoftwareOutputDeviceWin(OutputDeviceBacking* backing,
} }
SoftwareOutputDeviceWin::~SoftwareOutputDeviceWin() { SoftwareOutputDeviceWin::~SoftwareOutputDeviceWin() {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!in_paint_); DCHECK(!in_paint_);
if (backing_) if (backing_)
backing_->UnregisterOutputDevice(this); backing_->UnregisterOutputDevice(this);
...@@ -111,7 +108,7 @@ SoftwareOutputDeviceWin::~SoftwareOutputDeviceWin() { ...@@ -111,7 +108,7 @@ SoftwareOutputDeviceWin::~SoftwareOutputDeviceWin() {
void SoftwareOutputDeviceWin::Resize(const gfx::Size& viewport_pixel_size, void SoftwareOutputDeviceWin::Resize(const gfx::Size& viewport_pixel_size,
float scale_factor) { float scale_factor) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!in_paint_); DCHECK(!in_paint_);
if (viewport_pixel_size_ == viewport_pixel_size) if (viewport_pixel_size_ == viewport_pixel_size)
...@@ -124,7 +121,7 @@ void SoftwareOutputDeviceWin::Resize(const gfx::Size& viewport_pixel_size, ...@@ -124,7 +121,7 @@ void SoftwareOutputDeviceWin::Resize(const gfx::Size& viewport_pixel_size,
} }
SkCanvas* SoftwareOutputDeviceWin::BeginPaint(const gfx::Rect& damage_rect) { SkCanvas* SoftwareOutputDeviceWin::BeginPaint(const gfx::Rect& damage_rect) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!in_paint_); DCHECK(!in_paint_);
if (!contents_) { if (!contents_) {
HANDLE shared_section = NULL; HANDLE shared_section = NULL;
...@@ -151,7 +148,7 @@ SkCanvas* SoftwareOutputDeviceWin::BeginPaint(const gfx::Rect& damage_rect) { ...@@ -151,7 +148,7 @@ SkCanvas* SoftwareOutputDeviceWin::BeginPaint(const gfx::Rect& damage_rect) {
} }
void SoftwareOutputDeviceWin::EndPaint() { void SoftwareOutputDeviceWin::EndPaint() {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(in_paint_); DCHECK(in_paint_);
in_paint_ = false; in_paint_ = false;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <vector> #include <vector>
#include "base/macros.h" #include "base/macros.h"
#include "base/threading/thread_checker.h"
#include "components/viz/service/display/software_output_device.h" #include "components/viz/service/display/software_output_device.h"
#include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkRefCnt.h" #include "third_party/skia/include/core/SkRefCnt.h"
...@@ -64,6 +65,7 @@ class SoftwareOutputDeviceWin : public viz::SoftwareOutputDevice { ...@@ -64,6 +65,7 @@ class SoftwareOutputDeviceWin : public viz::SoftwareOutputDevice {
bool is_hwnd_composited_; bool is_hwnd_composited_;
OutputDeviceBacking* backing_; OutputDeviceBacking* backing_;
bool in_paint_; bool in_paint_;
THREAD_CHECKER(thread_checker_);
DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceWin); DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceWin);
}; };
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include "content/public/browser/browser_thread.h"
#include "third_party/skia/include/core/SkImageInfo.h" #include "third_party/skia/include/core/SkImageInfo.h"
#include "ui/base/x/x11_util.h" #include "ui/base/x/x11_util.h"
#include "ui/base/x/x11_util_internal.h" #include "ui/base/x/x11_util_internal.h"
...@@ -21,7 +20,7 @@ namespace content { ...@@ -21,7 +20,7 @@ namespace content {
SoftwareOutputDeviceX11::SoftwareOutputDeviceX11(gfx::AcceleratedWidget widget) SoftwareOutputDeviceX11::SoftwareOutputDeviceX11(gfx::AcceleratedWidget widget)
: widget_(widget), display_(gfx::GetXDisplay()), gc_(NULL) { : widget_(widget), display_(gfx::GetXDisplay()), gc_(NULL) {
// TODO(skaslev) Remove this when crbug.com/180702 is fixed. // TODO(skaslev) Remove this when crbug.com/180702 is fixed.
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
gc_ = XCreateGC(display_, widget_, 0, NULL); gc_ = XCreateGC(display_, widget_, 0, NULL);
if (!XGetWindowAttributes(display_, widget_, &attributes_)) { if (!XGetWindowAttributes(display_, widget_, &attributes_)) {
...@@ -31,13 +30,13 @@ SoftwareOutputDeviceX11::SoftwareOutputDeviceX11(gfx::AcceleratedWidget widget) ...@@ -31,13 +30,13 @@ SoftwareOutputDeviceX11::SoftwareOutputDeviceX11(gfx::AcceleratedWidget widget)
} }
SoftwareOutputDeviceX11::~SoftwareOutputDeviceX11() { SoftwareOutputDeviceX11::~SoftwareOutputDeviceX11() {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
XFreeGC(display_, gc_); XFreeGC(display_, gc_);
} }
void SoftwareOutputDeviceX11::EndPaint() { void SoftwareOutputDeviceX11::EndPaint() {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
SoftwareOutputDevice::EndPaint(); SoftwareOutputDevice::EndPaint();
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include "base/macros.h" #include "base/macros.h"
#include "base/threading/thread_checker.h"
#include "components/viz/service/display/software_output_device.h" #include "components/viz/service/display/software_output_device.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
#include "ui/gfx/x/x11_types.h" #include "ui/gfx/x/x11_types.h"
...@@ -27,6 +28,7 @@ class SoftwareOutputDeviceX11 : public viz::SoftwareOutputDevice { ...@@ -27,6 +28,7 @@ class SoftwareOutputDeviceX11 : public viz::SoftwareOutputDevice {
XDisplay* display_; XDisplay* display_;
GC gc_; GC gc_;
XWindowAttributes attributes_; XWindowAttributes attributes_;
THREAD_CHECKER(thread_checker_);
DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceX11); DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceX11);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment