summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-07 21:48:49 +0000
committerboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-07 21:48:49 +0000
commit788dba553c892e40da68099f8b773fbf27155b20 (patch)
tree4954fdeaec525642a3797653d4c738ef35004596
parentdeadc49b961ff4c6d8e7bb5a4d890542f54179f1 (diff)
downloadchromium_src-788dba553c892e40da68099f8b773fbf27155b20.zip
chromium_src-788dba553c892e40da68099f8b773fbf27155b20.tar.gz
chromium_src-788dba553c892e40da68099f8b773fbf27155b20.tar.bz2
Add ContextProvider overrides to SynchronousCompositorFactory
SynchronousCompositorFactory does not create the main thread one since we have not figured out how to get its clients (video/webgl/canvas) to work in this architecture. This will cause dynamic but graceful failures when trying to load these type of contents. For compositor thread one, create ContextProviderInProcess. BUG=230197,239760 NOTRY=true Review URL: https://chromiumcodereview.appspot.com/16235005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204941 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/android/in_process/synchronous_compositor_impl.cc19
-rw-r--r--content/renderer/android/synchronous_compositor_factory.h6
-rw-r--r--content/renderer/render_thread_impl.cc18
-rw-r--r--content/renderer/render_thread_impl.h4
4 files changed, 43 insertions, 4 deletions
diff --git a/content/browser/android/in_process/synchronous_compositor_impl.cc b/content/browser/android/in_process/synchronous_compositor_impl.cc
index ea72bc7..7a53cd0 100644
--- a/content/browser/android/in_process/synchronous_compositor_impl.cc
+++ b/content/browser/android/in_process/synchronous_compositor_impl.cc
@@ -12,6 +12,7 @@
#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 "webkit/common/gpu/context_provider_in_process.h"
namespace content {
@@ -59,8 +60,26 @@ class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory {
return &synchronous_input_event_filter_;
}
+ virtual scoped_refptr<cc::ContextProvider>
+ GetOffscreenContextProviderForMainThread() OVERRIDE {
+ NOTIMPLEMENTED()
+ << "Synchronous compositor does not support main thread context yet.";
+ return scoped_refptr<cc::ContextProvider>();
+ }
+
+ virtual scoped_refptr<cc::ContextProvider>
+ GetOffscreenContextProviderForCompositorThread() OVERRIDE {
+ if (!offscreen_context_for_compositor_thread_ ||
+ offscreen_context_for_compositor_thread_->DestroyedOnMainThread()) {
+ offscreen_context_for_compositor_thread_ =
+ webkit::gpu::ContextProviderInProcess::Create();
+ }
+ return offscreen_context_for_compositor_thread_;
+ }
+
private:
SynchronousInputEventFilter synchronous_input_event_filter_;
+ scoped_refptr<cc::ContextProvider> offscreen_context_for_compositor_thread_;
};
base::LazyInstance<SynchronousCompositorFactoryImpl>::Leaky g_factory =
diff --git a/content/renderer/android/synchronous_compositor_factory.h b/content/renderer/android/synchronous_compositor_factory.h
index 06e7c36..234a033 100644
--- a/content/renderer/android/synchronous_compositor_factory.h
+++ b/content/renderer/android/synchronous_compositor_factory.h
@@ -13,6 +13,7 @@ class MessageLoopProxy;
}
namespace cc {
+class ContextProvider;
class OutputSurface;
}
@@ -39,6 +40,11 @@ class SynchronousCompositorFactory {
// The factory maintains ownership of the returned interface.
virtual InputHandlerManagerClient* GetInputHandlerManagerClient() = 0;
+ virtual scoped_refptr<cc::ContextProvider>
+ GetOffscreenContextProviderForMainThread() = 0;
+ virtual scoped_refptr<cc::ContextProvider>
+ GetOffscreenContextProviderForCompositorThread() = 0;
+
protected:
SynchronousCompositorFactory() {}
~SynchronousCompositorFactory() {}
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 5bb608c..a141f8f 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -1026,10 +1026,17 @@ RenderThreadImpl::CreateOffscreenContext3d() {
GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d")));
}
-scoped_refptr<ContextProviderCommandBuffer>
+scoped_refptr<cc::ContextProvider>
RenderThreadImpl::OffscreenContextProviderForMainThread() {
DCHECK(IsMainThread());
+#if defined(OS_ANDROID)
+ if (SynchronousCompositorFactory* factory =
+ SynchronousCompositorFactory::GetInstance()) {
+ return factory->GetOffscreenContextProviderForMainThread();
+ }
+#endif
+
if (!shared_contexts_main_thread_.get() ||
shared_contexts_main_thread_->DestroyedOnMainThread()) {
shared_contexts_main_thread_ =
@@ -1041,10 +1048,17 @@ RenderThreadImpl::OffscreenContextProviderForMainThread() {
return shared_contexts_main_thread_;
}
-scoped_refptr<ContextProviderCommandBuffer>
+scoped_refptr<cc::ContextProvider>
RenderThreadImpl::OffscreenContextProviderForCompositorThread() {
DCHECK(IsMainThread());
+#if defined(OS_ANDROID)
+ if (SynchronousCompositorFactory* factory =
+ SynchronousCompositorFactory::GetInstance()) {
+ return factory->GetOffscreenContextProviderForCompositorThread();
+ }
+#endif
+
if (!shared_contexts_compositor_thread_.get() ||
shared_contexts_compositor_thread_->DestroyedOnMainThread()) {
shared_contexts_compositor_thread_ =
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index 1d92af2..c797a60 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -278,9 +278,9 @@ class CONTENT_EXPORT RenderThreadImpl : public RenderThread,
// Handle loss of the shared GpuVDAContext3D context above.
static void OnGpuVDAContextLoss();
- scoped_refptr<ContextProviderCommandBuffer>
+ scoped_refptr<cc::ContextProvider>
OffscreenContextProviderForMainThread();
- scoped_refptr<ContextProviderCommandBuffer>
+ scoped_refptr<cc::ContextProvider>
OffscreenContextProviderForCompositorThread();
// AudioRendererMixerManager instance which manages renderer side mixer