diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-28 20:39:34 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-28 20:39:34 +0000 |
commit | dbccad7fadd2cca98722f1fd99b394c8a20ebf05 (patch) | |
tree | de735deef76cefea85c5d30c922173ab2b3fa7ba /mojo/examples/compositor_app | |
parent | b9f812940e5ad63483cbd467aed26bb65296e321 (diff) | |
download | chromium_src-dbccad7fadd2cca98722f1fd99b394c8a20ebf05.zip chromium_src-dbccad7fadd2cca98722f1fd99b394c8a20ebf05.tar.gz chromium_src-dbccad7fadd2cca98722f1fd99b394c8a20ebf05.tar.bz2 |
Send size to NativeViewportClient::OnCreated instead of GLES2Client::DidCreateContext
The size is not really a concept that belongs to GL. Note, we can still start creating
the context before we get OnCreated.
BUG=333157
Review URL: https://codereview.chromium.org/131153007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247496 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/examples/compositor_app')
-rw-r--r-- | mojo/examples/compositor_app/compositor_app.cc | 6 | ||||
-rw-r--r-- | mojo/examples/compositor_app/compositor_host.cc | 5 | ||||
-rw-r--r-- | mojo/examples/compositor_app/compositor_host.h | 3 | ||||
-rw-r--r-- | mojo/examples/compositor_app/gles2_client_impl.cc | 14 | ||||
-rw-r--r-- | mojo/examples/compositor_app/gles2_client_impl.h | 12 |
5 files changed, 19 insertions, 21 deletions
diff --git a/mojo/examples/compositor_app/compositor_app.cc b/mojo/examples/compositor_app/compositor_app.cc index de6db6b..f8c7078 100644 --- a/mojo/examples/compositor_app/compositor_app.cc +++ b/mojo/examples/compositor_app/compositor_app.cc @@ -52,6 +52,7 @@ class SampleApp : public ShellClient { public: explicit NativeViewportClientImpl(ScopedMessagePipeHandle viewport_handle) : viewport_(viewport_handle.Pass(), this) { + AllocationScope allocation; viewport_->Create(gfx::Rect(10, 10, 800, 600)); viewport_->Show(); ScopedMessagePipeHandle gles2_handle; @@ -66,8 +67,8 @@ class SampleApp : public ShellClient { host_.reset(new CompositorHost(gles2_client_.get())); } - void DidCreateContext(gfx::Size viewport_size) { - host_->DidCreateContext(viewport_size); + void DidCreateContext() { + host_->DidCreateContext(); } virtual ~NativeViewportClientImpl() {} @@ -80,6 +81,7 @@ class SampleApp : public ShellClient { } virtual void OnBoundsChanged(const Rect& bounds) MOJO_OVERRIDE { + host_->SetSize(bounds.size()); } virtual void OnEvent(const Event& event) MOJO_OVERRIDE { diff --git a/mojo/examples/compositor_app/compositor_host.cc b/mojo/examples/compositor_app/compositor_host.cc index d78b994..cc45c19 100644 --- a/mojo/examples/compositor_app/compositor_host.cc +++ b/mojo/examples/compositor_app/compositor_host.cc @@ -67,8 +67,11 @@ CompositorHost::CompositorHost(GLES2ClientImpl* gles2_client_impl) CompositorHost::~CompositorHost() {} -void CompositorHost::DidCreateContext(gfx::Size viewport_size) { +void CompositorHost::SetSize(gfx::Size viewport_size) { tree_->SetViewportSize(viewport_size); +} + +void CompositorHost::DidCreateContext() { tree_->SetLayerTreeHostClientReady(); tree_->InitializeOutputSurfaceIfNeeded(); } diff --git a/mojo/examples/compositor_app/compositor_host.h b/mojo/examples/compositor_app/compositor_host.h index d033b1c..3b4064f 100644 --- a/mojo/examples/compositor_app/compositor_host.h +++ b/mojo/examples/compositor_app/compositor_host.h @@ -25,7 +25,8 @@ class CompositorHost : public cc::LayerTreeHostClient { explicit CompositorHost(GLES2ClientImpl* gles2_client_impl); virtual ~CompositorHost(); - void DidCreateContext(gfx::Size viewport_size); + void SetSize(gfx::Size viewport_size); + void DidCreateContext(); // cc::LayerTreeHostClient implementation. virtual void WillBeginMainFrame(int frame_id) OVERRIDE; diff --git a/mojo/examples/compositor_app/gles2_client_impl.cc b/mojo/examples/compositor_app/gles2_client_impl.cc index 3b59f96..5cc0321 100644 --- a/mojo/examples/compositor_app/gles2_client_impl.cc +++ b/mojo/examples/compositor_app/gles2_client_impl.cc @@ -13,7 +13,7 @@ namespace examples { GLES2ClientImpl::GLES2ClientImpl( ScopedMessagePipeHandle pipe, - const base::Callback<void(gfx::Size)>& context_created_callback) + const base::Callback<void()>& context_created_callback) : context_created_callback_(context_created_callback) { context_ = MojoGLES2CreateContext( pipe.release().value(), @@ -42,18 +42,14 @@ gpu::ContextSupport* GLES2ClientImpl::Support() const { MojoGLES2GetContextSupport(context_)); } -void GLES2ClientImpl::DidCreateContext(uint32_t width, - uint32_t height) { +void GLES2ClientImpl::DidCreateContext() { TRACE_EVENT0("compositor_app", "DidCreateContext"); if (!context_created_callback_.is_null()) - context_created_callback_.Run(gfx::Size(width, height)); + context_created_callback_.Run(); } -void GLES2ClientImpl::DidCreateContextThunk( - void* closure, - uint32_t width, - uint32_t height) { - static_cast<GLES2ClientImpl*>(closure)->DidCreateContext(width, height); +void GLES2ClientImpl::DidCreateContextThunk(void* closure) { + static_cast<GLES2ClientImpl*>(closure)->DidCreateContext(); } void GLES2ClientImpl::ContextLost() { diff --git a/mojo/examples/compositor_app/gles2_client_impl.h b/mojo/examples/compositor_app/gles2_client_impl.h index e162b1d..657bf79 100644 --- a/mojo/examples/compositor_app/gles2_client_impl.h +++ b/mojo/examples/compositor_app/gles2_client_impl.h @@ -10,7 +10,6 @@ #include "mojo/public/bindings/remote_ptr.h" #include "mojo/public/gles2/gles2.h" #include "mojom/native_viewport.h" -#include "ui/gfx/size.h" namespace gpu { class ContextSupport; @@ -26,22 +25,19 @@ class GLES2ClientImpl { public: GLES2ClientImpl( ScopedMessagePipeHandle pipe, - const base::Callback<void(gfx::Size)>& context_created_callback); + const base::Callback<void()>& context_created_callback); virtual ~GLES2ClientImpl(); gpu::gles2::GLES2Interface* Interface() const; gpu::ContextSupport* Support() const; private: - void DidCreateContext(uint32_t width, uint32_t height); - static void DidCreateContextThunk( - void* closure, - uint32_t width, - uint32_t height); + void DidCreateContext(); + static void DidCreateContextThunk(void* closure); void ContextLost(); static void ContextLostThunk(void* closure); - base::Callback<void(gfx::Size viewport_size)> context_created_callback_; + base::Callback<void()> context_created_callback_; MojoGLES2Context context_; |