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

Side by Side Diff: content/renderer/render_widget.cc

Issue 1916923004: Request context sharing via content::ContextProviderCommandBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sharegroup: . Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // framebuffer doesn't need alpha, depth, stencil, antialiasing. 213 // framebuffer doesn't need alpha, depth, stencil, antialiasing.
214 gpu::gles2::ContextCreationAttribHelper attributes; 214 gpu::gles2::ContextCreationAttribHelper attributes;
215 attributes.alpha_size = -1; 215 attributes.alpha_size = -1;
216 attributes.depth_size = 0; 216 attributes.depth_size = 0;
217 attributes.stencil_size = 0; 217 attributes.stencil_size = 0;
218 attributes.samples = 0; 218 attributes.samples = 0;
219 attributes.sample_buffers = 0; 219 attributes.sample_buffers = 0;
220 attributes.bind_generates_resource = false; 220 attributes.bind_generates_resource = false;
221 attributes.lose_context_when_out_of_memory = true; 221 attributes.lose_context_when_out_of_memory = true;
222 222
223 bool share_resources = true;
224 bool automatic_flushes = false; 223 bool automatic_flushes = false;
225 224
226 return base::WrapUnique(new content::WebGraphicsContext3DCommandBufferImpl( 225 return base::WrapUnique(new content::WebGraphicsContext3DCommandBufferImpl(
227 gpu::kNullSurfaceHandle, url, gpu_channel_host.get(), attributes, 226 gpu::kNullSurfaceHandle, url, gpu_channel_host.get(), attributes,
228 gfx::PreferIntegratedGpu, share_resources, automatic_flushes, nullptr)); 227 gfx::PreferIntegratedGpu, automatic_flushes));
229 } 228 }
230 229
231 } // namespace 230 } // namespace
232 231
233 namespace content { 232 namespace content {
234 233
235 // RenderWidget --------------------------------------------------------------- 234 // RenderWidget ---------------------------------------------------------------
236 235
237 RenderWidget::RenderWidget(CompositorDependencies* compositor_deps, 236 RenderWidget::RenderWidget(CompositorDependencies* compositor_deps,
238 blink::WebPopupType popup_type, 237 blink::WebPopupType popup_type,
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 } 772 }
774 773
775 gpu::SharedMemoryLimits limits; 774 gpu::SharedMemoryLimits limits;
776 // The renderer compositor context doesn't do a lot of stuff, so we don't 775 // The renderer compositor context doesn't do a lot of stuff, so we don't
777 // expect it to need a lot of space for commands or transfer. Raster and 776 // expect it to need a lot of space for commands or transfer. Raster and
778 // uploads happen on the worker context instead. 777 // uploads happen on the worker context instead.
779 limits.command_buffer_size = 64 * 1024; 778 limits.command_buffer_size = 64 * 1024;
780 limits.start_transfer_buffer_size = 64 * 1024; 779 limits.start_transfer_buffer_size = 64 * 1024;
781 limits.min_transfer_buffer_size = 64 * 1024; 780 limits.min_transfer_buffer_size = 64 * 1024;
782 781
783 context_provider = new ContextProviderCommandBuffer(
784 CreateOffscreenContext(std::move(gpu_channel_host),
785 GetURLForGraphicsContext3D()),
786 limits, RENDER_COMPOSITOR_CONTEXT);
787 worker_context_provider = 782 worker_context_provider =
788 RenderThreadImpl::current()->SharedWorkerContextProvider(); 783 RenderThreadImpl::current()->SharedWorkerContextProvider();
789 if (!worker_context_provider) { 784 if (!worker_context_provider) {
790 // Cause the compositor to wait and try again. 785 // Cause the compositor to wait and try again.
791 return nullptr; 786 return nullptr;
792 } 787 }
793 788
789 // The compositor context shares resources with the worker context.
790 context_provider = new ContextProviderCommandBuffer(
791 CreateOffscreenContext(std::move(gpu_channel_host),
792 GetURLForGraphicsContext3D()),
793 limits, worker_context_provider.get(), RENDER_COMPOSITOR_CONTEXT);
794
794 #if defined(OS_ANDROID) 795 #if defined(OS_ANDROID)
795 if (RenderThreadImpl::current() && 796 if (RenderThreadImpl::current() &&
796 RenderThreadImpl::current()->sync_compositor_message_filter()) { 797 RenderThreadImpl::current()->sync_compositor_message_filter()) {
797 uint32_t output_surface_id = next_output_surface_id_++; 798 uint32_t output_surface_id = next_output_surface_id_++;
798 return base::WrapUnique(new SynchronousCompositorOutputSurface( 799 return base::WrapUnique(new SynchronousCompositorOutputSurface(
799 context_provider, worker_context_provider, routing_id(), 800 context_provider, worker_context_provider, routing_id(),
800 output_surface_id, 801 output_surface_id,
801 RenderThreadImpl::current()->sync_compositor_message_filter(), 802 RenderThreadImpl::current()->sync_compositor_message_filter(),
802 frame_swap_message_queue_)); 803 frame_swap_message_queue_));
803 } 804 }
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 } 2104 }
2104 2105
2105 float RenderWidget::GetOriginalDeviceScaleFactor() const { 2106 float RenderWidget::GetOriginalDeviceScaleFactor() const {
2106 return 2107 return
2107 screen_metrics_emulator_ ? 2108 screen_metrics_emulator_ ?
2108 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : 2109 screen_metrics_emulator_->original_screen_info().deviceScaleFactor :
2109 device_scale_factor_; 2110 device_scale_factor_;
2110 } 2111 }
2111 2112
2112 } // namespace content 2113 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | content/renderer/renderer_blink_platform_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698