diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/views/mus/BUILD.gn | 1 | ||||
-rw-r--r-- | ui/views/mus/DEPS | 1 | ||||
-rw-r--r-- | ui/views/mus/native_widget_mus.cc | 8 | ||||
-rw-r--r-- | ui/views/mus/platform_window_mus.cc | 16 | ||||
-rw-r--r-- | ui/views/mus/window_tree_host_mus.cc | 9 | ||||
-rw-r--r-- | ui/views/mus/window_tree_host_mus.h | 10 |
6 files changed, 41 insertions, 4 deletions
diff --git a/ui/views/mus/BUILD.gn b/ui/views/mus/BUILD.gn index dd80c4a..5ab84dc 100644 --- a/ui/views/mus/BUILD.gn +++ b/ui/views/mus/BUILD.gn @@ -42,6 +42,7 @@ component("mus") { "//base/third_party/dynamic_annotations", "//cc", "//cc/surfaces", + "//components/bitmap_uploader", "//components/mus/gles2:lib", "//components/mus/public/cpp", "//components/mus/public/interfaces", diff --git a/ui/views/mus/DEPS b/ui/views/mus/DEPS index 6ddcc64..447d4b4 100644 --- a/ui/views/mus/DEPS +++ b/ui/views/mus/DEPS @@ -2,6 +2,7 @@ include_rules = [ "+cc", "-cc/blink", "+components/font_service/public", + "+components/bitmap_uploader", "+components/gpu", "+components/mus", "+components/resource_provider", diff --git a/ui/views/mus/native_widget_mus.cc b/ui/views/mus/native_widget_mus.cc index 578c9ea..70245bc 100644 --- a/ui/views/mus/native_widget_mus.cc +++ b/ui/views/mus/native_widget_mus.cc @@ -259,13 +259,15 @@ void NativeWidgetMus::InitNativeWidget(const Widget::InitParams& params) { // picked up. ui::ContextFactory* default_context_factory = aura::Env::GetInstance()->context_factory(); - aura::Env::GetInstance()->set_context_factory(context_factory_.get()); + // For Chrome, we need the GpuProcessTransportFactory so that renderer and + // browser pixels are composited into a single backing + // SoftwareOutputDeviceMus. + if (!default_context_factory) + aura::Env::GetInstance()->set_context_factory(context_factory_.get()); window_tree_host_.reset( new WindowTreeHostMus(shell_, this, window_, surface_type_)); window_tree_host_->InitHost(); aura::Env::GetInstance()->set_context_factory(default_context_factory); - DCHECK_EQ(context_factory_.get(), - window_tree_host_->compositor()->context_factory()); focus_client_.reset(new wm::FocusController(new FocusRulesImpl)); diff --git a/ui/views/mus/platform_window_mus.cc b/ui/views/mus/platform_window_mus.cc index be343eb..3a9c85f 100644 --- a/ui/views/mus/platform_window_mus.cc +++ b/ui/views/mus/platform_window_mus.cc @@ -13,6 +13,11 @@ namespace views { +namespace { +static uint32_t accelerated_widget_count = 1; + +} // namespace + PlatformWindowMus::PlatformWindowMus(ui::PlatformWindowDelegate* delegate, mus::Window* mus_window) : delegate_(delegate), @@ -23,9 +28,18 @@ PlatformWindowMus::PlatformWindowMus(ui::PlatformWindowDelegate* delegate, DCHECK(mus_window_); mus_window_->AddObserver(this); + // We need accelerated widget numbers to be different for each + // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t + // has this property. +#if defined(OS_WIN) + delegate_->OnAcceleratedWidgetAvailable( + reinterpret_cast<gfx::AcceleratedWidget>(accelerated_widget_count++), + mus_window_->viewport_metrics().device_pixel_ratio); +#else delegate_->OnAcceleratedWidgetAvailable( - gfx::kNullAcceleratedWidget, + static_cast<gfx::AcceleratedWidget>(accelerated_widget_count++), mus_window_->viewport_metrics().device_pixel_ratio); +#endif } PlatformWindowMus::~PlatformWindowMus() { diff --git a/ui/views/mus/window_tree_host_mus.cc b/ui/views/mus/window_tree_host_mus.cc index 7e01767..5f0b825 100644 --- a/ui/views/mus/window_tree_host_mus.cc +++ b/ui/views/mus/window_tree_host_mus.cc @@ -4,9 +4,11 @@ #include "ui/views/mus/window_tree_host_mus.h" +#include "components/bitmap_uploader/bitmap_uploader.h" #include "mojo/application/public/interfaces/shell.mojom.h" #include "ui/aura/window.h" #include "ui/aura/window_event_dispatcher.h" +#include "ui/base/view_prop.h" #include "ui/events/event.h" #include "ui/views/mus/input_method_mus.h" #include "ui/views/mus/native_widget_mus.h" @@ -31,6 +33,13 @@ WindowTreeHostMus::WindowTreeHostMus(mojo::Shell* shell, dispatcher()->set_transform_events(false); compositor()->SetHostHasTransparentBackground(true); + bitmap_uploader_.reset(new bitmap_uploader::BitmapUploader(window)); + bitmap_uploader_->Init(shell); + prop_.reset( + new ui::ViewProp(GetAcceleratedWidget(), + bitmap_uploader::kBitmapUploaderForAcceleratedWidget, + bitmap_uploader_.get())); + input_method_.reset(new InputMethodMUS(this, window)); SetSharedInputMethod(input_method_.get()); } diff --git a/ui/views/mus/window_tree_host_mus.h b/ui/views/mus/window_tree_host_mus.h index 5882a28..1a4473e 100644 --- a/ui/views/mus/window_tree_host_mus.h +++ b/ui/views/mus/window_tree_host_mus.h @@ -12,6 +12,10 @@ class SkBitmap; +namespace bitmap_uploader { +class BitmapUploader; +} + namespace mojo { class Shell; } @@ -22,6 +26,7 @@ class Window; namespace ui { class Compositor; +class ViewProp; } namespace views { @@ -39,6 +44,9 @@ class VIEWS_MUS_EXPORT WindowTreeHostMus : public aura::WindowTreeHostPlatform { ~WindowTreeHostMus() override; PlatformWindowMus* platform_window(); + bitmap_uploader::BitmapUploader* bitmap_uploader() { + return bitmap_uploader_.get(); + }; ui::PlatformWindowState show_state() const { return show_state_; } private: @@ -51,6 +59,8 @@ class VIEWS_MUS_EXPORT WindowTreeHostMus : public aura::WindowTreeHostPlatform { NativeWidgetMus* native_widget_; scoped_ptr<InputMethodMUS> input_method_; ui::PlatformWindowState show_state_; + scoped_ptr<bitmap_uploader::BitmapUploader> bitmap_uploader_; + scoped_ptr<ui::ViewProp> prop_; DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMus); }; |