diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-26 07:19:22 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-26 07:19:22 +0000 |
commit | 4bfa211bf27da8ed735142c1907df4a3ba434541 (patch) | |
tree | 3bef9bdd70f67a0390e6d61e753f32bb9c65ad61 /content/browser/aura | |
parent | 73354b07104ff0faec0b7a0f09620b7b8159d207 (diff) | |
download | chromium_src-4bfa211bf27da8ed735142c1907df4a3ba434541.zip chromium_src-4bfa211bf27da8ed735142c1907df4a3ba434541.tar.gz chromium_src-4bfa211bf27da8ed735142c1907df4a3ba434541.tar.bz2 |
Notify reflector when the source surface is ready
This is speculative fix for the case where the source
surface may not be added to the surface map yet.
BUG=294479
R=piman@chromium.org
Review URL: https://codereview.chromium.org/24242005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225373 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/aura')
-rw-r--r-- | content/browser/aura/browser_compositor_output_surface.cc | 2 | ||||
-rw-r--r-- | content/browser/aura/reflector_impl.cc | 23 | ||||
-rw-r--r-- | content/browser/aura/reflector_impl.h | 3 |
3 files changed, 26 insertions, 2 deletions
diff --git a/content/browser/aura/browser_compositor_output_surface.cc b/content/browser/aura/browser_compositor_output_surface.cc index 36e5dcd..7a60b86 100644 --- a/content/browser/aura/browser_compositor_output_surface.cc +++ b/content/browser/aura/browser_compositor_output_surface.cc @@ -58,6 +58,8 @@ bool BrowserCompositorOutputSurface::BindToClient( return false; output_surface_map_->AddWithID(this, surface_id_); + if (reflector_) + reflector_->OnSourceSurfaceReady(surface_id_); return true; } diff --git a/content/browser/aura/reflector_impl.cc b/content/browser/aura/reflector_impl.cc index 78726ec..eabd6e4 100644 --- a/content/browser/aura/reflector_impl.cc +++ b/content/browser/aura/reflector_impl.cc @@ -33,7 +33,19 @@ ReflectorImpl::ReflectorImpl( } void ReflectorImpl::InitOnImplThread() { - AttachToOutputSurface(output_surface_map_->Lookup(surface_id_)); + // Ignore if the reflector was shutdown before + // initialized, or it's already initialized. + if (!output_surface_map_ || gl_helper_.get()) + return; + + BrowserCompositorOutputSurface* source_surface = + output_surface_map_->Lookup(surface_id_); + // Skip if the source surface isn't ready yet. This will be + // initiailze when the source surface becomes ready. + if (!source_surface) + return; + + AttachToOutputSurface(source_surface); gl_helper_->CopyTextureFullImage(texture_id_, texture_size_); // The shared texture doesn't have the data, so invokes full redraw // now. @@ -43,6 +55,11 @@ void ReflectorImpl::InitOnImplThread() { scoped_refptr<ReflectorImpl>(this))); } +void ReflectorImpl::OnSourceSurfaceReady(int surface_id) { + DCHECK_EQ(surface_id_, surface_id); + InitOnImplThread(); +} + void ReflectorImpl::Shutdown() { mirroring_compositor_ = NULL; mirroring_layer_ = NULL; @@ -55,7 +72,9 @@ void ReflectorImpl::Shutdown() { void ReflectorImpl::ShutdownOnImplThread() { BrowserCompositorOutputSurface* output_surface = output_surface_map_->Lookup(surface_id_); - output_surface->SetReflector(NULL); + if (output_surface) + output_surface->SetReflector(NULL); + output_surface_map_ = NULL; gl_helper_.reset(); // The instance must be deleted on main thread. main_message_loop_->PostTask( diff --git a/content/browser/aura/reflector_impl.h b/content/browser/aura/reflector_impl.h index b24acff..e5b5128 100644 --- a/content/browser/aura/reflector_impl.h +++ b/content/browser/aura/reflector_impl.h @@ -75,6 +75,9 @@ class ReflectorImpl : public ImageTransportFactoryObserver, // race with ImplThread accessing |texture_id_|. void CreateSharedTexture(); + // Called when the source surface is bound and available. This must + // be called on ImplThread. + void OnSourceSurfaceReady(int surface_id); private: virtual ~ReflectorImpl(); |