diff options
Diffstat (limited to 'content/browser/renderer_host')
3 files changed, 17 insertions, 3 deletions
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index efc04f2..ce153f5 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc @@ -210,14 +210,20 @@ cc::SurfaceManager* CompositorImpl::GetSurfaceManager() { // static scoped_ptr<cc::SurfaceIdAllocator> CompositorImpl::CreateSurfaceIdAllocator() { - return make_scoped_ptr(new cc::SurfaceIdAllocator(++g_surface_id_namespace)); + scoped_ptr<cc::SurfaceIdAllocator> allocator( + new cc::SurfaceIdAllocator(++g_surface_id_namespace)); + cc::SurfaceManager* manager = GetSurfaceManager(); + DCHECK(manager); + allocator->RegisterSurfaceIdNamespace(manager); + return allocator.Pass(); } CompositorImpl::CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window) : root_layer_(cc::Layer::Create(Compositor::LayerSettings())), resource_manager_(&ui_resource_provider_), - surface_id_allocator_(CreateSurfaceIdAllocator()), + surface_id_allocator_(GetSurfaceManager() ? CreateSurfaceIdAllocator() + : nullptr), has_transparent_background_(false), device_scale_factor_(1), window_(NULL), diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc index 7b1b23b..59f2b32 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.cc +++ b/content/browser/renderer_host/render_widget_host_view_android.cc @@ -343,6 +343,8 @@ RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( locks_on_frame_count_(0), observing_root_window_(false), weak_ptr_factory_(this) { + if (CompositorImpl::GetSurfaceManager()) + id_allocator_ = CompositorImpl::CreateSurfaceIdAllocator(); host_->SetView(this); SetContentViewCore(content_view_core); } @@ -1037,7 +1039,6 @@ void RenderWidgetHostViewAndroid::SubmitFrame( cc::SurfaceManager* manager = CompositorImpl::GetSurfaceManager(); if (manager) { if (!surface_factory_) { - id_allocator_ = CompositorImpl::CreateSurfaceIdAllocator(); surface_factory_ = make_scoped_ptr(new cc::SurfaceFactory(manager, this)); } if (surface_id_.is_null() || @@ -1759,6 +1760,12 @@ void RenderWidgetHostViewAndroid::DidStopFlinging() { content_view_core_->DidStopFlinging(); } +uint32_t RenderWidgetHostViewAndroid::GetSurfaceIdNamespace() { + if (id_allocator_) + return id_allocator_->id_namespace(); + return 0; +} + void RenderWidgetHostViewAndroid::SetContentViewCore( ContentViewCoreImpl* content_view_core) { RemoveLayers(); diff --git a/content/browser/renderer_host/render_widget_host_view_android.h b/content/browser/renderer_host/render_widget_host_view_android.h index fc8decb..f1ac987 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.h +++ b/content/browser/renderer_host/render_widget_host_view_android.h @@ -154,6 +154,7 @@ class CONTENT_EXPORT RenderWidgetHostViewAndroid scoped_ptr<cc::CompositorFrame> frame) override; void DidOverscroll(const DidOverscrollParams& params) override; void DidStopFlinging() override; + uint32_t GetSurfaceIdNamespace() override; void ShowDisambiguationPopup(const gfx::Rect& rect_pixels, const SkBitmap& zoomed_bitmap) override; scoped_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget() override; |