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

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

Issue 451753003: Mojo multiple command buffer support and sample (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better casts 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 9f201b0845a6a45905710b4198d6f8791f04d8b0..fe4f653622b4ea3ecd82386feff2f78f27d3c601 100644
--- a/mojo/services/view_manager/window_tree_host_impl.cc
+++ b/mojo/services/view_manager/window_tree_host_impl.cc
@@ -67,29 +67,21 @@ void RootLayoutManager::SetChildBounds(aura::Window* child,
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));
-
- 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_);
+ native_viewport_->Show();
window()->SetLayoutManager(new RootLayoutManager());
}
@@ -107,13 +99,11 @@ ui::EventSource* WindowTreeHostImpl::GetEventSource() {
}
gfx::AcceleratedWidget WindowTreeHostImpl::GetAcceleratedWidget() {
- NOTIMPLEMENTED() << "GetAcceleratedWidget";
- return gfx::kNullAcceleratedWidget;
+ return widget_;
}
void WindowTreeHostImpl::Show() {
window()->Show();
- native_viewport_->Show();
}
void WindowTreeHostImpl::Hide() {
@@ -168,21 +158,36 @@ ui::EventProcessor* WindowTreeHostImpl::GetEventProcessor() {
////////////////////////////////////////////////////////////////////////////////
// WindowTreeHostImpl, NativeViewportClient implementation:
-void WindowTreeHostImpl::OnCreated() {
- CreateCompositor(GetAcceleratedWidget());
+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_ = bit_cast<gfx::AcceleratedWidget>(
+ static_cast<uintptr_t>(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);
compositor_created_callback_.Run();
}
void WindowTreeHostImpl::OnBoundsChanged(RectPtr bounds) {
bounds_ = bounds.To<gfx::Rect>();
- OnHostResized(bounds_.size());
+ if (context_factory_)
+ OnHostResized(bounds_.size());
}
-void WindowTreeHostImpl::OnDestroyed(const mojo::Callback<void()>& callback) {
+void WindowTreeHostImpl::OnDestroyed() {
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