diff options
author | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-07 17:07:45 +0000 |
---|---|---|
committer | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-07 17:07:45 +0000 |
commit | 85ad3220a81f2b4b13481af945a0ba48c6ee1a51 (patch) | |
tree | 13f96b412e6c3bc9435c48addfd641e9e2d810e0 /content | |
parent | e031900006fba801379b7ca874b680945fc9c087 (diff) | |
download | chromium_src-85ad3220a81f2b4b13481af945a0ba48c6ee1a51.zip chromium_src-85ad3220a81f2b4b13481af945a0ba48c6ee1a51.tar.gz chromium_src-85ad3220a81f2b4b13481af945a0ba48c6ee1a51.tar.bz2 |
Move SynchronousCompositorFactoryImpl into separate h/cc files
This is a long overdue clean up to make future changes in this area
saner. Only shuffling code and these cosmetic changes:
Removed unused SynchronousCompositorImpl* argument from
SynchronousCompositorFactoryImpl::CompositorInitializedHardwareDraw
and SynchronousCompositorFactoryImpl::CompositorReleasedHardwareDraw.
Add virtual SynchronousCompositorFactory destructor.
BUG=
NOTRY=true
Review URL: https://codereview.chromium.org/102963010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243314 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
5 files changed, 298 insertions, 230 deletions
diff --git a/content/browser/android/in_process/synchronous_compositor_factory_impl.cc b/content/browser/android/in_process/synchronous_compositor_factory_impl.cc new file mode 100644 index 0000000..5fc68f3 --- /dev/null +++ b/content/browser/android/in_process/synchronous_compositor_factory_impl.cc @@ -0,0 +1,209 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/android/in_process/synchronous_compositor_factory_impl.h" + +#include "content/browser/android/in_process/synchronous_compositor_output_surface.h" +#include "content/public/browser/browser_thread.h" +#include "gpu/command_buffer/client/gl_in_process_context.h" +#include "ui/gl/android/surface_texture.h" +#include "ui/gl/gl_surface.h" +#include "webkit/common/gpu/context_provider_in_process.h" +#include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" + +namespace content { + +namespace { + +class VideoContextProvider + : public StreamTextureFactorySynchronousImpl::ContextProvider { + public: + VideoContextProvider( + const scoped_refptr<cc::ContextProvider>& context_provider, + gpu::GLInProcessContext* gl_in_process_context) + : context_provider_(context_provider), + gl_in_process_context_(gl_in_process_context) {} + + virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( + uint32 stream_id) OVERRIDE { + return gl_in_process_context_->GetSurfaceTexture(stream_id); + } + + virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE { + return context_provider_->Context3d(); + } + + private: + friend class base::RefCountedThreadSafe<VideoContextProvider>; + virtual ~VideoContextProvider() {} + + scoped_refptr<cc::ContextProvider> context_provider_; + gpu::GLInProcessContext* gl_in_process_context_; + + DISALLOW_COPY_AND_ASSIGN(VideoContextProvider); +}; + +} // namespace + +using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; + +SynchronousCompositorFactoryImpl::SynchronousCompositorFactoryImpl() + : wrapped_gl_context_for_main_thread_(NULL), + num_hardware_compositors_(0) { + SynchronousCompositorFactory::SetInstance(this); +} + +SynchronousCompositorFactoryImpl::~SynchronousCompositorFactoryImpl() {} + +scoped_refptr<base::MessageLoopProxy> +SynchronousCompositorFactoryImpl::GetCompositorMessageLoop() { + return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI); +} + +scoped_ptr<cc::OutputSurface> +SynchronousCompositorFactoryImpl::CreateOutputSurface(int routing_id) { + scoped_ptr<SynchronousCompositorOutputSurface> output_surface( + new SynchronousCompositorOutputSurface(routing_id)); + return output_surface.PassAs<cc::OutputSurface>(); +} + +InputHandlerManagerClient* +SynchronousCompositorFactoryImpl::GetInputHandlerManagerClient() { + return synchronous_input_event_filter(); +} + +scoped_refptr<cc::ContextProvider> +SynchronousCompositorFactoryImpl::GetOffscreenContextProviderForMainThread() { + // This check only guarantees the main thread context is created after + // a compositor did successfully initialize hardware draw in the past. + // In particular this does not guarantee that the main thread context + // will fail creation when all compositors release hardware draw. + bool failed = !CanCreateMainThreadContext(); + if (!failed && + (!offscreen_context_for_main_thread_.get() || + offscreen_context_for_main_thread_->DestroyedOnMainThread())) { + offscreen_context_for_main_thread_ = + webkit::gpu::ContextProviderInProcess::Create( + CreateOffscreenContext(), + "Compositor-Offscreen"); + failed = !offscreen_context_for_main_thread_.get() || + !offscreen_context_for_main_thread_->BindToCurrentThread(); + } + + if (failed) { + offscreen_context_for_main_thread_ = NULL; + wrapped_gl_context_for_main_thread_ = NULL; + } + return offscreen_context_for_main_thread_; +} + +// This is called on both renderer main thread (offscreen context creation +// path shared between cross-process and in-process platforms) and renderer +// compositor impl thread (InitializeHwDraw) in order to support Android +// WebView synchronously enable and disable hardware mode multiple times in +// the same task. This is ok because in-process WGC3D creation may happen on +// any thread and is lightweight. +scoped_refptr<cc::ContextProvider> SynchronousCompositorFactoryImpl:: + GetOffscreenContextProviderForCompositorThread() { + base::AutoLock lock(offscreen_context_for_compositor_thread_lock_); + if (!offscreen_context_for_compositor_thread_.get() || + offscreen_context_for_compositor_thread_->DestroyedOnMainThread()) { + offscreen_context_for_compositor_thread_ = + webkit::gpu::ContextProviderInProcess::CreateOffscreen(); + } + return offscreen_context_for_compositor_thread_; +} + +scoped_ptr<StreamTextureFactory> +SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int view_id) { + scoped_ptr<StreamTextureFactorySynchronousImpl> factory( + new StreamTextureFactorySynchronousImpl( + base::Bind(&SynchronousCompositorFactoryImpl:: + TryCreateStreamTextureFactory, + base::Unretained(this)), + view_id)); + return factory.PassAs<StreamTextureFactory>(); +} + +void SynchronousCompositorFactoryImpl::CompositorInitializedHardwareDraw() { + base::AutoLock lock(num_hardware_compositor_lock_); + num_hardware_compositors_++; +} + +void SynchronousCompositorFactoryImpl::CompositorReleasedHardwareDraw() { + bool should_release_resources = false; + { + base::AutoLock lock(num_hardware_compositor_lock_); + DCHECK_GT(num_hardware_compositors_, 0u); + num_hardware_compositors_--; + should_release_resources = num_hardware_compositors_ == 0u; + } + if (should_release_resources) + ReleaseGlobalHardwareResources(); +} + +void SynchronousCompositorFactoryImpl::ReleaseGlobalHardwareResources() { + { + base::AutoLock lock(offscreen_context_for_compositor_thread_lock_); + offscreen_context_for_compositor_thread_ = NULL; + } + + // TODO(boliu): Properly clean up command buffer server of main thread + // context here. +} + +bool SynchronousCompositorFactoryImpl::CanCreateMainThreadContext() { + base::AutoLock lock(num_hardware_compositor_lock_); + return num_hardware_compositors_ > 0; +} + +scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider> +SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory() { + scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider> + context_provider; + if (CanCreateMainThreadContext() && + GetOffscreenContextProviderForMainThread()) { + DCHECK(offscreen_context_for_main_thread_); + DCHECK(wrapped_gl_context_for_main_thread_); + context_provider = + new VideoContextProvider(offscreen_context_for_main_thread_, + wrapped_gl_context_for_main_thread_); + } + return context_provider; +} + +// TODO(boliu): Deduplicate this with synchronous_compositor_output_surface.cc. +scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> +SynchronousCompositorFactoryImpl::CreateOffscreenContext() { + if (!gfx::GLSurface::InitializeOneOff()) + return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); + + const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; + + blink::WebGraphicsContext3D::Attributes attributes; + attributes.antialias = false; + attributes.shareResources = true; + attributes.noAutomaticFlushes = true; + + gpu::GLInProcessContextAttribs in_process_attribs; + WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( + attributes, &in_process_attribs); + scoped_ptr<gpu::GLInProcessContext> context( + gpu::GLInProcessContext::CreateContext(true, + NULL, + gfx::Size(1, 1), + attributes.shareResources, + in_process_attribs, + gpu_preference)); + + wrapped_gl_context_for_main_thread_ = context.get(); + if (!context.get()) + return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); + + return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( + WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( + context.Pass(), attributes)); +} + +} // namespace content diff --git a/content/browser/android/in_process/synchronous_compositor_factory_impl.h b/content/browser/android/in_process/synchronous_compositor_factory_impl.h new file mode 100644 index 0000000..40bcbac --- /dev/null +++ b/content/browser/android/in_process/synchronous_compositor_factory_impl.h @@ -0,0 +1,83 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_FACTORY_IMPL_H_ +#define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_FACTORY_IMPL_H_ + +#include "base/synchronization/lock.h" +#include "content/browser/android/in_process/synchronous_input_event_filter.h" +#include "content/renderer/android/synchronous_compositor_factory.h" +#include "content/renderer/media/android/stream_texture_factory_android_synchronous_impl.h" + +namespace gpu { +class GLInProcessContext; +} + +namespace webkit { +namespace gpu { +class WebGraphicsContext3DInProcessCommandBufferImpl; +} +} + +namespace content { + +class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory { + public: + SynchronousCompositorFactoryImpl(); + virtual ~SynchronousCompositorFactoryImpl(); + + // SynchronousCompositorFactory + virtual scoped_refptr<base::MessageLoopProxy> GetCompositorMessageLoop() + OVERRIDE; + virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(int routing_id) + OVERRIDE; + virtual InputHandlerManagerClient* GetInputHandlerManagerClient() OVERRIDE; + virtual scoped_refptr<cc::ContextProvider> + GetOffscreenContextProviderForMainThread() OVERRIDE; + // This is called on both renderer main thread (offscreen context creation + // path shared between cross-process and in-process platforms) and renderer + // compositor impl thread (InitializeHwDraw) in order to support Android + // WebView synchronously enable and disable hardware mode multiple times in + // the same task. This is ok because in-process WGC3D creation may happen on + // any thread and is lightweight. + virtual scoped_refptr<cc::ContextProvider> + GetOffscreenContextProviderForCompositorThread() OVERRIDE; + virtual scoped_ptr<StreamTextureFactory> CreateStreamTextureFactory( + int view_id) OVERRIDE; + + SynchronousInputEventFilter* synchronous_input_event_filter() { + return &synchronous_input_event_filter_; + } + + void CompositorInitializedHardwareDraw(); + void CompositorReleasedHardwareDraw(); + + private: + void ReleaseGlobalHardwareResources(); + bool CanCreateMainThreadContext(); + scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider> + TryCreateStreamTextureFactory(); + scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl> + CreateOffscreenContext(); + + SynchronousInputEventFilter synchronous_input_event_filter_; + + // Only guards construction and destruction of + // |offscreen_context_for_compositor_thread_|, not usage. + base::Lock offscreen_context_for_compositor_thread_lock_; + scoped_refptr<cc::ContextProvider> offscreen_context_for_main_thread_; + // This is a pointer to the context owned by + // |offscreen_context_for_main_thread_|. + gpu::GLInProcessContext* wrapped_gl_context_for_main_thread_; + scoped_refptr<cc::ContextProvider> offscreen_context_for_compositor_thread_; + + // |num_hardware_compositor_lock_| is updated on UI thread only but can be + // read on renderer main thread. + base::Lock num_hardware_compositor_lock_; + unsigned int num_hardware_compositors_; +}; + +} // namespace content + +#endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_FACTORY_IMPL_H_ diff --git a/content/browser/android/in_process/synchronous_compositor_impl.cc b/content/browser/android/in_process/synchronous_compositor_impl.cc index 230b1e9..f9fda92 100644 --- a/content/browser/android/in_process/synchronous_compositor_impl.cc +++ b/content/browser/android/in_process/synchronous_compositor_impl.cc @@ -6,30 +6,21 @@ #include "base/lazy_instance.h" #include "base/message_loop/message_loop.h" -#include "base/synchronization/lock.h" #include "cc/input/input_handler.h" #include "cc/input/layer_scroll_offset_delegate.h" +#include "content/browser/android/in_process/synchronous_compositor_factory_impl.h" #include "content/browser/android/in_process/synchronous_input_event_filter.h" #include "content/browser/renderer_host/render_widget_host_view_android.h" #include "content/public/browser/android/synchronous_compositor_client.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" -#include "content/renderer/android/synchronous_compositor_factory.h" -#include "content/renderer/media/android/stream_texture_factory_android_synchronous_impl.h" -#include "gpu/command_buffer/client/gl_in_process_context.h" -#include "gpu/command_buffer/service/stream_texture_manager_in_process_android.h" -#include "ui/gl/android/surface_texture.h" #include "ui/gl/gl_surface.h" -#include "webkit/common/gpu/context_provider_in_process.h" -#include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" namespace content { namespace { -using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; - int GetInProcessRendererId() { content::RenderProcessHost::iterator it = content::RenderProcessHost::AllHostsIterator(); @@ -45,223 +36,6 @@ int GetInProcessRendererId() { return id; } -class VideoContextProvider - : public StreamTextureFactorySynchronousImpl::ContextProvider { - public: - VideoContextProvider( - const scoped_refptr<cc::ContextProvider>& context_provider, - gpu::GLInProcessContext* gl_in_process_context) - : context_provider_(context_provider), - gl_in_process_context_(gl_in_process_context) {} - - virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( - uint32 stream_id) OVERRIDE { - return gl_in_process_context_->GetSurfaceTexture(stream_id); - } - - virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE { - return context_provider_->Context3d(); - } - - private: - friend class base::RefCountedThreadSafe<VideoContextProvider>; - virtual ~VideoContextProvider() {} - - scoped_refptr<cc::ContextProvider> context_provider_; - gpu::GLInProcessContext* gl_in_process_context_; - - DISALLOW_COPY_AND_ASSIGN(VideoContextProvider); -}; - -class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory { - public: - SynchronousCompositorFactoryImpl() - : wrapped_gl_context_for_main_thread_(NULL), - num_hardware_compositors_(0) { - SynchronousCompositorFactory::SetInstance(this); - } - - // SynchronousCompositorFactory - virtual scoped_refptr<base::MessageLoopProxy> - GetCompositorMessageLoop() OVERRIDE { - return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI); - } - - virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface( - int routing_id) OVERRIDE { - scoped_ptr<SynchronousCompositorOutputSurface> output_surface( - new SynchronousCompositorOutputSurface(routing_id)); - return output_surface.PassAs<cc::OutputSurface>(); - } - - virtual InputHandlerManagerClient* GetInputHandlerManagerClient() OVERRIDE { - return synchronous_input_event_filter(); - } - - SynchronousInputEventFilter* synchronous_input_event_filter() { - return &synchronous_input_event_filter_; - } - - scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> - CreateOffscreenContext() { - if (!gfx::GLSurface::InitializeOneOff()) - return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); - - const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; - - blink::WebGraphicsContext3D::Attributes attributes; - attributes.antialias = false; - attributes.shareResources = true; - attributes.noAutomaticFlushes = true; - - gpu::GLInProcessContextAttribs in_process_attribs; - WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( - attributes, &in_process_attribs); - scoped_ptr<gpu::GLInProcessContext> context( - gpu::GLInProcessContext::CreateContext(true, - NULL, - gfx::Size(1, 1), - attributes.shareResources, - in_process_attribs, - gpu_preference)); - - wrapped_gl_context_for_main_thread_ = context.get(); - if (!context.get()) - return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); - - return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( - WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( - context.Pass(), attributes)); - } - - virtual scoped_refptr<cc::ContextProvider> - GetOffscreenContextProviderForMainThread() OVERRIDE { - // This check only guarantees the main thread context is created after - // a compositor did successfully initialize hardware draw in the past. - // In particular this does not guarantee that the main thread context - // will fail creation when all compositors release hardware draw. - bool failed = !CanCreateMainThreadContext(); - if (!failed && - (!offscreen_context_for_main_thread_.get() || - offscreen_context_for_main_thread_->DestroyedOnMainThread())) { - offscreen_context_for_main_thread_ = - webkit::gpu::ContextProviderInProcess::Create( - CreateOffscreenContext(), - "Compositor-Offscreen"); - failed = !offscreen_context_for_main_thread_.get() || - !offscreen_context_for_main_thread_->BindToCurrentThread(); - } - - if (failed) { - offscreen_context_for_main_thread_ = NULL; - wrapped_gl_context_for_main_thread_ = NULL; - } - return offscreen_context_for_main_thread_; - } - - // This is called on both renderer main thread (offscreen context creation - // path shared between cross-process and in-process platforms) and renderer - // compositor impl thread (InitializeHwDraw) in order to support Android - // WebView synchronously enable and disable hardware mode multiple times in - // the same task. This is ok because in-process WGC3D creation may happen on - // any thread and is lightweight. - virtual scoped_refptr<cc::ContextProvider> - GetOffscreenContextProviderForCompositorThread() OVERRIDE { - base::AutoLock lock(offscreen_context_for_compositor_thread_lock_); - if (!offscreen_context_for_compositor_thread_.get() || - offscreen_context_for_compositor_thread_->DestroyedOnMainThread()) { - offscreen_context_for_compositor_thread_ = - webkit::gpu::ContextProviderInProcess::CreateOffscreen(); - } - return offscreen_context_for_compositor_thread_; - } - - virtual scoped_ptr<StreamTextureFactory> CreateStreamTextureFactory( - int view_id) OVERRIDE { - scoped_ptr<StreamTextureFactorySynchronousImpl> factory( - new StreamTextureFactorySynchronousImpl( - base::Bind(&SynchronousCompositorFactoryImpl:: - TryCreateStreamTextureFactory, - base::Unretained(this)), - view_id)); - return factory.PassAs<StreamTextureFactory>(); - } - - void CompositorInitializedHardwareDraw(SynchronousCompositorImpl* compositor); - void CompositorReleasedHardwareDraw(SynchronousCompositorImpl* compositor); - - private: - void ReleaseGlobalHardwareResources(); - bool CanCreateMainThreadContext(); - scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider> - TryCreateStreamTextureFactory(); - - SynchronousInputEventFilter synchronous_input_event_filter_; - - // Only guards construction and destruction of - // |offscreen_context_for_compositor_thread_|, not usage. - base::Lock offscreen_context_for_compositor_thread_lock_; - scoped_refptr<cc::ContextProvider> offscreen_context_for_main_thread_; - // This is a pointer to the context owned by - // |offscreen_context_for_main_thread_|. - gpu::GLInProcessContext* wrapped_gl_context_for_main_thread_; - scoped_refptr<cc::ContextProvider> offscreen_context_for_compositor_thread_; - - // |num_hardware_compositor_lock_| is updated on UI thread only but can be - // read on renderer main thread. - base::Lock num_hardware_compositor_lock_; - unsigned int num_hardware_compositors_; -}; - -void SynchronousCompositorFactoryImpl::CompositorInitializedHardwareDraw( - SynchronousCompositorImpl* compositor) { - base::AutoLock lock(num_hardware_compositor_lock_); - num_hardware_compositors_++; -} - -void SynchronousCompositorFactoryImpl::CompositorReleasedHardwareDraw( - SynchronousCompositorImpl* compositor) { - bool should_release_resources = false; - { - base::AutoLock lock(num_hardware_compositor_lock_); - DCHECK_GT(num_hardware_compositors_, 0u); - num_hardware_compositors_--; - should_release_resources = num_hardware_compositors_ == 0u; - } - if (should_release_resources) - ReleaseGlobalHardwareResources(); -} - -void SynchronousCompositorFactoryImpl::ReleaseGlobalHardwareResources() { - { - base::AutoLock lock(offscreen_context_for_compositor_thread_lock_); - offscreen_context_for_compositor_thread_ = NULL; - } - - // TODO(boliu): Properly clean up command buffer server of main thread - // context here. -} - -bool SynchronousCompositorFactoryImpl::CanCreateMainThreadContext() { - base::AutoLock lock(num_hardware_compositor_lock_); - return num_hardware_compositors_ > 0; -} - -scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider> -SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory() { - scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider> - context_provider; - if (CanCreateMainThreadContext() && - GetOffscreenContextProviderForMainThread()) { - DCHECK(offscreen_context_for_main_thread_); - DCHECK(wrapped_gl_context_for_main_thread_); - context_provider = - new VideoContextProvider(offscreen_context_for_main_thread_, - wrapped_gl_context_for_main_thread_); - } - return context_provider; -} - base::LazyInstance<SynchronousCompositorFactoryImpl>::Leaky g_factory = LAZY_INSTANCE_INITIALIZER; @@ -316,7 +90,7 @@ bool SynchronousCompositorImpl::InitializeHwDraw( surface, g_factory.Get().GetOffscreenContextProviderForCompositorThread()); if (success) - g_factory.Get().CompositorInitializedHardwareDraw(this); + g_factory.Get().CompositorInitializedHardwareDraw(); return success; } @@ -324,7 +98,7 @@ void SynchronousCompositorImpl::ReleaseHwDraw() { DCHECK(CalledOnValidThread()); DCHECK(output_surface_); output_surface_->ReleaseHwDraw(); - g_factory.Get().CompositorReleasedHardwareDraw(this); + g_factory.Get().CompositorReleasedHardwareDraw(); } bool SynchronousCompositorImpl::DemandDrawHw( diff --git a/content/content_browser.gypi b/content/content_browser.gypi index b4389c6..037238e 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -266,6 +266,8 @@ 'browser/android/devtools_auth.cc', 'browser/android/edge_effect.h', 'browser/android/edge_effect.cc', + 'browser/android/in_process/synchronous_compositor_factory_impl.cc', + 'browser/android/in_process/synchronous_compositor_factory_impl.h', 'browser/android/in_process/synchronous_compositor_impl.cc', 'browser/android/in_process/synchronous_compositor_impl.h', 'browser/android/in_process/synchronous_compositor_output_surface.cc', diff --git a/content/renderer/android/synchronous_compositor_factory.h b/content/renderer/android/synchronous_compositor_factory.h index bd625be..77c0500 100644 --- a/content/renderer/android/synchronous_compositor_factory.h +++ b/content/renderer/android/synchronous_compositor_factory.h @@ -50,7 +50,7 @@ class SynchronousCompositorFactory { protected: SynchronousCompositorFactory() {} - ~SynchronousCompositorFactory() {} + virtual ~SynchronousCompositorFactory() {} }; } |