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

Unified Diff: mojo/examples/aura_demo/root_window_host_mojo.cc

Issue 131153007: Send size to NativeViewportClient::OnCreated instead of GLES2Client::DidCreateContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, fix various issues Created 6 years, 11 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/examples/aura_demo/root_window_host_mojo.h ('k') | mojo/examples/compositor_app/compositor_app.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/examples/aura_demo/root_window_host_mojo.cc
diff --git a/mojo/examples/aura_demo/root_window_host_mojo.cc b/mojo/examples/aura_demo/root_window_host_mojo.cc
index e1f5cb793f5cdc59fef8c539fcdb3de58239b1bb..5f389989fc6cd6ba46172a5d842802b7e29a93c4 100644
--- a/mojo/examples/aura_demo/root_window_host_mojo.cc
+++ b/mojo/examples/aura_demo/root_window_host_mojo.cc
@@ -30,7 +30,8 @@ WindowTreeHostMojo::WindowTreeHostMojo(
ScopedMessagePipeHandle viewport_handle,
const gfx::Rect& bounds,
const base::Callback<void()>& compositor_created_callback)
- : native_viewport_(viewport_handle.Pass(), this),
+ : context_created_(false),
+ native_viewport_(viewport_handle.Pass(), this),
compositor_created_callback_(compositor_created_callback) {
AllocationScope scope;
native_viewport_->Create(bounds);
@@ -159,7 +160,9 @@ void WindowTreeHostMojo::OnCreated() {
void WindowTreeHostMojo::OnBoundsChanged(const Rect& bounds) {
bounds_ = gfx::Rect(bounds.position().x(), bounds.position().y(),
bounds.size().width(), bounds.size().height());
- window()->SetBounds(gfx::Rect(bounds_.size()));
+ if (delegate_)
+ window()->SetBounds(gfx::Rect(bounds_.size()));
+ CreateCompositorIfNeeded();
}
void WindowTreeHostMojo::OnDestroyed() {
@@ -199,10 +202,17 @@ void WindowTreeHostMojo::OnEvent(const Event& event) {
////////////////////////////////////////////////////////////////////////////////
// WindowTreeHostMojo, private:
-void WindowTreeHostMojo::DidCreateContext(gfx::Size viewport_size) {
+void WindowTreeHostMojo::DidCreateContext() {
+ context_created_ = true;
+ CreateCompositorIfNeeded();
+}
+
+void WindowTreeHostMojo::CreateCompositorIfNeeded() {
+ if (bounds_.IsEmpty() || !context_created_)
+ return;
CreateCompositor(GetAcceleratedWidget());
compositor_created_callback_.Run();
- NotifyHostResized(viewport_size);
+ NotifyHostResized(bounds_.size());
}
} // namespace examples
« no previous file with comments | « mojo/examples/aura_demo/root_window_host_mojo.h ('k') | mojo/examples/compositor_app/compositor_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698