Index: mojo/services/view_manager/window_tree_host_impl.cc |
diff --git a/mojo/services/view_manager/window_tree_host_impl.cc b/mojo/services/view_manager/window_tree_host_impl.cc |
index 267bdcaf039613beed5edb21171ed9e31ff32f0b..9f201b0845a6a45905710b4198d6f8791f04d8b0 100644 |
--- a/mojo/services/view_manager/window_tree_host_impl.cc |
+++ b/mojo/services/view_manager/window_tree_host_impl.cc |
@@ -67,21 +67,29 @@ |
WindowTreeHostImpl::WindowTreeHostImpl( |
NativeViewportPtr viewport, |
- GpuPtr gpu_service, |
const gfx::Rect& bounds, |
const Callback<void()>& compositor_created_callback, |
const Callback<void()>& native_viewport_closed_callback, |
const Callback<void(EventPtr)>& event_received_callback) |
: native_viewport_(viewport.Pass()), |
- gpu_service_(gpu_service.Pass()), |
- widget_(gfx::kNullAcceleratedWidget), |
compositor_created_callback_(compositor_created_callback), |
native_viewport_closed_callback_(native_viewport_closed_callback), |
event_received_callback_(event_received_callback), |
bounds_(bounds) { |
native_viewport_.set_client(this); |
native_viewport_->Create(Rect::From(bounds)); |
- native_viewport_->Show(); |
+ |
+ MessagePipe pipe; |
+ native_viewport_->CreateGLES2Context( |
+ MakeRequest<CommandBuffer>(pipe.handle0.Pass())); |
+ |
+ // The ContextFactory must exist before any Compositors are created. |
+ if (context_factory_) { |
+ delete context_factory_; |
+ context_factory_ = NULL; |
+ } |
+ context_factory_ = new ContextFactoryImpl(pipe.handle1.Pass()); |
+ aura::Env::GetInstance()->set_context_factory(context_factory_); |
window()->SetLayoutManager(new RootLayoutManager()); |
} |
@@ -99,11 +107,13 @@ |
} |
gfx::AcceleratedWidget WindowTreeHostImpl::GetAcceleratedWidget() { |
- return widget_; |
+ NOTIMPLEMENTED() << "GetAcceleratedWidget"; |
+ return gfx::kNullAcceleratedWidget; |
} |
void WindowTreeHostImpl::Show() { |
window()->Show(); |
+ native_viewport_->Show(); |
} |
void WindowTreeHostImpl::Hide() { |
@@ -158,35 +168,21 @@ |
//////////////////////////////////////////////////////////////////////////////// |
// WindowTreeHostImpl, NativeViewportClient implementation: |
-void WindowTreeHostImpl::OnCreated(uint64_t native_viewport_id) { |
- LOG(ERROR) << "OnCreated " << native_viewport_id; |
- CommandBufferPtr cb; |
- gpu_service_->CreateOnscreenGLES2Context( |
- native_viewport_id, Size::From(bounds_.size()), Get(&cb)); |
- widget_ = reinterpret_cast<gfx::AcceleratedWidget>(native_viewport_id); |
- |
- // The ContextFactory must exist before any Compositors are created. |
- if (context_factory_) { |
- delete context_factory_; |
- context_factory_ = NULL; |
- } |
- context_factory_ = new ContextFactoryImpl(cb.PassMessagePipe()); |
- aura::Env::GetInstance()->set_context_factory(context_factory_); |
- |
- CreateCompositor(gfx::kNullAcceleratedWidget); |
+void WindowTreeHostImpl::OnCreated() { |
+ CreateCompositor(GetAcceleratedWidget()); |
compositor_created_callback_.Run(); |
} |
void WindowTreeHostImpl::OnBoundsChanged(RectPtr bounds) { |
bounds_ = bounds.To<gfx::Rect>(); |
- if (context_factory_) |
- OnHostResized(bounds_.size()); |
+ OnHostResized(bounds_.size()); |
} |
-void WindowTreeHostImpl::OnDestroyed() { |
+void WindowTreeHostImpl::OnDestroyed(const mojo::Callback<void()>& callback) { |
DestroyCompositor(); |
native_viewport_closed_callback_.Run(); |
// TODO(beng): quit the message loop once we are on our own thread. |
+ callback.Run(); |
} |
void WindowTreeHostImpl::OnEvent(EventPtr event, |