Index: ui/views/mus/window_tree_host_mus.cc |
diff --git a/ui/views/mus/window_tree_host_mus.cc b/ui/views/mus/window_tree_host_mus.cc |
index 61c6f4670e47047b292f5e16424dfeb3f987f791..17f5c7e39c28089bc3380206e2dff7c21ae07e29 100644 |
--- a/ui/views/mus/window_tree_host_mus.cc |
+++ b/ui/views/mus/window_tree_host_mus.cc |
@@ -4,6 +4,7 @@ |
#include "ui/views/mus/window_tree_host_mus.h" |
+#include "components/bitmap_uploader/bitmap_uploader.h" |
#include "components/mus/public/cpp/property_type_converters.h" |
#include "components/mus/public/cpp/window_observer.h" |
#include "components/mus/public/cpp/window_property.h" |
@@ -15,6 +16,7 @@ |
#include "ui/aura/env.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/events/event_constants.h" |
#include "ui/platform_window/platform_window.h" |
@@ -27,6 +29,8 @@ |
namespace views { |
namespace { |
+static uint32_t widget_counter = 1; |
+ |
void WindowManagerCallback(mus::mojom::WindowManagerErrorCode error_code) {} |
class PlatformWindowMus : public ui::PlatformWindow, |
@@ -41,7 +45,11 @@ class PlatformWindowMus : public ui::PlatformWindow, |
DCHECK(mus_window_); |
mus_window_->AddObserver(this); |
- delegate_->OnAcceleratedWidgetAvailable(gfx::kNullAcceleratedWidget, |
+ // We need accelerated widget numbers to be different for each |
+ // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t |
+ // has this property. |
+ delegate_->OnAcceleratedWidgetAvailable( |
+ static_cast<gfx::AcceleratedWidget>(widget_counter++), |
Fady Samuel
2015/11/13 02:18:02
What is the purpose of this counter?
rjkroege
2015/11/13 03:10:44
The accelerated widget number. Need a different wi
|
mus_window_->viewport_metrics().device_pixel_ratio); |
} |
@@ -174,11 +182,24 @@ WindowTreeHostMus::WindowTreeHostMus(mojo::Shell* shell, |
// 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) { |
Fady Samuel
2015/11/13 02:18:02
Do we need the other context factory if we have a
rjkroege
2015/11/13 03:10:43
Not at present. But we will later.
|
+ aura::Env::GetInstance()->set_context_factory(context_factory_.get()); |
+ } |
+ |
SetPlatformWindow(make_scoped_ptr(new PlatformWindowMus(this, window))); |
compositor()->SetHostHasTransparentBackground(true); |
aura::Env::GetInstance()->set_context_factory(default_context_factory); |
- DCHECK_EQ(context_factory_.get(), compositor()->context_factory()); |
+ |
+ 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()); |