Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(940)

Unified Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 2731833002: content: Add public context creation API. (Closed)
Patch Set: piman's comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/public/browser/android/compositor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/compositor_impl_android.cc
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index 1bd183949eed4152b5183ce0e7064af6876df0da..132e0857c8eb7667380a9c6fa949e652136f5c9f 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -184,6 +184,28 @@ gpu::gles2::ContextCreationAttribHelper GetCompositorContextAttributes(
return attributes;
}
+void CreateContextProviderAfterGpuChannelEstablished(
+ gpu::SurfaceHandle handle,
+ gpu::gles2::ContextCreationAttribHelper attributes,
+ gpu::SharedMemoryLimits shared_memory_limits,
+ Compositor::ContextProviderCallback callback,
+ scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) {
+ if (!gpu_channel_host)
+ callback.Run(nullptr);
+
+ constexpr bool automatic_flushes = false;
+ constexpr bool support_locking = false;
+ scoped_refptr<ui::ContextProviderCommandBuffer> context_provider =
+ new ui::ContextProviderCommandBuffer(
+ std::move(gpu_channel_host), gpu::GPU_STREAM_DEFAULT,
+ gpu::GpuStreamPriority::NORMAL, handle,
+ GURL(std::string("chrome://gpu/Compositor::CreateContextProvider")),
+ automatic_flushes, support_locking, shared_memory_limits, attributes,
+ nullptr /* shared_context */,
+ ui::command_buffer_metrics::CONTEXT_TYPE_UNKNOWN);
+ callback.Run(std::move(context_provider));
+}
+
class AndroidOutputSurface : public cc::OutputSurface {
public:
AndroidOutputSurface(
@@ -355,6 +377,17 @@ void Compositor::Initialize() {
}
// static
+void Compositor::CreateContextProvider(
+ gpu::SurfaceHandle handle,
+ gpu::gles2::ContextCreationAttribHelper attributes,
+ gpu::SharedMemoryLimits shared_memory_limits,
+ ContextProviderCallback callback) {
+ BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel(
+ base::Bind(&CreateContextProviderAfterGpuChannelEstablished, handle,
+ attributes, shared_memory_limits, callback));
+}
+
+// static
cc::SurfaceManager* CompositorImpl::GetSurfaceManager() {
return &g_compositor_dependencies.Get().surface_manager;
}
« no previous file with comments | « no previous file | content/public/browser/android/compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698