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

Side by Side Diff: content/renderer/render_widget.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: rebase 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 return content::RenderWidgetMusConnection::GetOrCreate( 196 return content::RenderWidgetMusConnection::GetOrCreate(
197 widget->routing_id()); 197 widget->routing_id());
198 } 198 }
199 #endif 199 #endif
200 // If we don't have a connection to the Mojo shell, then we want to route IPCs 200 // If we don't have a connection to the Mojo shell, then we want to route IPCs
201 // back to the browser process rather than Mus so we use the |widget| as the 201 // back to the browser process rather than Mus so we use the |widget| as the
202 // RenderWidgetInputHandlerDelegate. 202 // RenderWidgetInputHandlerDelegate.
203 return widget; 203 return widget;
204 } 204 }
205 205
206 std::unique_ptr<content::WebGraphicsContext3DCommandBufferImpl>
207 CreateOffscreenContext(scoped_refptr<gpu::GpuChannelHost> gpu_channel_host,
208 const GURL& url) {
209 DCHECK(gpu_channel_host);
210
211 // This is for an offscreen context for the compositor. So the default
212 // framebuffer doesn't need alpha, depth, stencil, antialiasing.
213 gpu::gles2::ContextCreationAttribHelper attributes;
214 attributes.alpha_size = -1;
215 attributes.depth_size = 0;
216 attributes.stencil_size = 0;
217 attributes.samples = 0;
218 attributes.sample_buffers = 0;
219 attributes.bind_generates_resource = false;
220 attributes.lose_context_when_out_of_memory = true;
221
222 bool automatic_flushes = false;
223
224 return base::WrapUnique(new content::WebGraphicsContext3DCommandBufferImpl(
225 gpu::kNullSurfaceHandle, url, std::move(gpu_channel_host), attributes,
226 gfx::PreferIntegratedGpu, automatic_flushes));
227 }
228
229 } // namespace 206 } // namespace
230 207
231 namespace content { 208 namespace content {
232 209
233 // RenderWidget --------------------------------------------------------------- 210 // RenderWidget ---------------------------------------------------------------
234 211
235 RenderWidget::RenderWidget(CompositorDependencies* compositor_deps, 212 RenderWidget::RenderWidget(CompositorDependencies* compositor_deps,
236 blink::WebPopupType popup_type, 213 blink::WebPopupType popup_type,
237 const blink::WebScreenInfo& screen_info, 214 const blink::WebScreenInfo& screen_info,
238 bool swapped_out, 215 bool swapped_out,
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 limits.start_transfer_buffer_size = 64 * 1024; 755 limits.start_transfer_buffer_size = 64 * 1024;
779 limits.min_transfer_buffer_size = 64 * 1024; 756 limits.min_transfer_buffer_size = 64 * 1024;
780 757
781 worker_context_provider = 758 worker_context_provider =
782 RenderThreadImpl::current()->SharedWorkerContextProvider(); 759 RenderThreadImpl::current()->SharedWorkerContextProvider();
783 if (!worker_context_provider) { 760 if (!worker_context_provider) {
784 // Cause the compositor to wait and try again. 761 // Cause the compositor to wait and try again.
785 return nullptr; 762 return nullptr;
786 } 763 }
787 764
765 // This is for an offscreen context for the compositor. So the default
766 // framebuffer doesn't need alpha, depth, stencil, antialiasing.
767 gpu::gles2::ContextCreationAttribHelper attributes;
768 attributes.alpha_size = -1;
769 attributes.depth_size = 0;
770 attributes.stencil_size = 0;
771 attributes.samples = 0;
772 attributes.sample_buffers = 0;
773 attributes.bind_generates_resource = false;
774 attributes.lose_context_when_out_of_memory = true;
775
776 bool automatic_flushes = false;
777
788 // The compositor context shares resources with the worker context. 778 // The compositor context shares resources with the worker context.
789 context_provider = new ContextProviderCommandBuffer( 779 context_provider = new ContextProviderCommandBuffer(
790 CreateOffscreenContext(std::move(gpu_channel_host), 780 base::WrapUnique(new content::WebGraphicsContext3DCommandBufferImpl(
791 GetURLForGraphicsContext3D()), 781 gpu::kNullSurfaceHandle, GetURLForGraphicsContext3D(),
792 limits, worker_context_provider.get(), RENDER_COMPOSITOR_CONTEXT); 782 std::move(gpu_channel_host), gfx::PreferIntegratedGpu,
783 automatic_flushes)),
784 limits, attributes, worker_context_provider.get(),
785 command_buffer_metrics::RENDER_COMPOSITOR_CONTEXT);
793 786
794 #if defined(OS_ANDROID) 787 #if defined(OS_ANDROID)
795 if (RenderThreadImpl::current() && 788 if (RenderThreadImpl::current() &&
796 RenderThreadImpl::current()->sync_compositor_message_filter()) { 789 RenderThreadImpl::current()->sync_compositor_message_filter()) {
797 uint32_t output_surface_id = next_output_surface_id_++; 790 uint32_t output_surface_id = next_output_surface_id_++;
798 return base::WrapUnique(new SynchronousCompositorOutputSurface( 791 return base::WrapUnique(new SynchronousCompositorOutputSurface(
799 context_provider, worker_context_provider, routing_id(), 792 context_provider, worker_context_provider, routing_id(),
800 output_surface_id, 793 output_surface_id,
801 RenderThreadImpl::current()->sync_compositor_message_filter(), 794 RenderThreadImpl::current()->sync_compositor_message_filter(),
802 frame_swap_message_queue_)); 795 frame_swap_message_queue_));
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 } 2096 }
2104 2097
2105 float RenderWidget::GetOriginalDeviceScaleFactor() const { 2098 float RenderWidget::GetOriginalDeviceScaleFactor() const {
2106 return 2099 return
2107 screen_metrics_emulator_ ? 2100 screen_metrics_emulator_ ?
2108 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : 2101 screen_metrics_emulator_->original_screen_info().deviceScaleFactor :
2109 device_scale_factor_; 2102 device_scale_factor_;
2110 } 2103 }
2111 2104
2112 } // namespace content 2105 } // 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