Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Unified Diff: mojo/services/view_manager/window_tree_host_impl.cc

Issue 480723002: Revert of Mojo multiple command buffer support and sample (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/services/view_manager/window_tree_host_impl.h ('k') | mojo/shell/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « mojo/services/view_manager/window_tree_host_impl.h ('k') | mojo/shell/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698