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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 1936773002: Move attributes and context type out to ContextProviderCommandBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rmwgc3d
Patch Set: attributes: welglstuff Created 4 years, 8 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
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index bb7fee61414f03142640573c3b07faf8a0121217..7c8d517176c131e77b7d4d2e79e14f6e6b848fc1 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -401,8 +401,9 @@ void StringToUintVector(const std::string& str, std::vector<unsigned>* vector) {
}
}
-std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> CreateOffscreenContext(
- scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) {
+scoped_refptr<ContextProviderCommandBuffer> CreateOffscreenContext(
+ scoped_refptr<gpu::GpuChannelHost> gpu_channel_host,
+ command_buffer_metrics::ContextType type) {
DCHECK(gpu_channel_host);
// This is used to create a few different offscreen contexts:
// - The shared main thread context (offscreen) used by blink for canvas.
@@ -418,11 +419,12 @@ std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> CreateOffscreenContext(
attributes.bind_generates_resource = false;
attributes.lose_context_when_out_of_memory = true;
constexpr bool automatic_flushes = false;
- return base::WrapUnique(new WebGraphicsContext3DCommandBufferImpl(
- gpu::kNullSurfaceHandle,
- GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d"),
- gpu_channel_host.get(), attributes, gfx::PreferIntegratedGpu,
- automatic_flushes));
+ return make_scoped_refptr(new ContextProviderCommandBuffer(
+ base::WrapUnique(new WebGraphicsContext3DCommandBufferImpl(
+ gpu::kNullSurfaceHandle,
+ GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext"),
+ gpu_channel_host.get(), gfx::PreferIntegratedGpu, automatic_flushes)),
+ gpu::SharedMemoryLimits(), attributes, nullptr, type));
}
} // namespace
@@ -1452,9 +1454,9 @@ RenderThreadImpl::SharedMainThreadContextProvider() {
return nullptr;
}
- shared_main_thread_contexts_ = new ContextProviderCommandBuffer(
- CreateOffscreenContext(std::move(gpu_channel_host)),
- gpu::SharedMemoryLimits(), nullptr, RENDERER_MAINTHREAD_CONTEXT);
+ shared_main_thread_contexts_ = CreateOffscreenContext(
+ std::move(gpu_channel_host),
+ command_buffer_metrics::RENDERER_MAINTHREAD_CONTEXT);
if (!shared_main_thread_contexts_->BindToCurrentThread())
shared_main_thread_contexts_ = nullptr;
return shared_main_thread_contexts_;
@@ -1954,9 +1956,9 @@ RenderThreadImpl::SharedWorkerContextProvider() {
return shared_worker_context_provider_;
}
- shared_worker_context_provider_ = new ContextProviderCommandBuffer(
- CreateOffscreenContext(std::move(gpu_channel_host)),
- gpu::SharedMemoryLimits(), nullptr, RENDER_WORKER_CONTEXT);
+ shared_worker_context_provider_ =
+ CreateOffscreenContext(std::move(gpu_channel_host),
+ command_buffer_metrics::RENDER_WORKER_CONTEXT);
if (!shared_worker_context_provider_->BindToCurrentThread())
shared_worker_context_provider_ = nullptr;
if (shared_worker_context_provider_)

Powered by Google App Engine
This is Rietveld 408576698