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

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

Issue 1900993002: Move SharedMemoryLimits out of WebGraphicsContext3DCommandBufferImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@limits
Patch Set: move-limits: types 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 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #include "content/renderer/input/input_handler_manager.h" 55 #include "content/renderer/input/input_handler_manager.h"
56 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 56 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
57 #include "content/renderer/render_frame_impl.h" 57 #include "content/renderer/render_frame_impl.h"
58 #include "content/renderer/render_frame_proxy.h" 58 #include "content/renderer/render_frame_proxy.h"
59 #include "content/renderer/render_process.h" 59 #include "content/renderer/render_process.h"
60 #include "content/renderer/render_thread_impl.h" 60 #include "content/renderer/render_thread_impl.h"
61 #include "content/renderer/render_view_impl.h" 61 #include "content/renderer/render_view_impl.h"
62 #include "content/renderer/render_widget_owner_delegate.h" 62 #include "content/renderer/render_widget_owner_delegate.h"
63 #include "content/renderer/renderer_blink_platform_impl.h" 63 #include "content/renderer/renderer_blink_platform_impl.h"
64 #include "content/renderer/resizing_mode_selector.h" 64 #include "content/renderer/resizing_mode_selector.h"
65 #include "gpu/command_buffer/client/shared_memory_limits.h"
65 #include "ipc/ipc_sync_message.h" 66 #include "ipc/ipc_sync_message.h"
66 #include "skia/ext/platform_canvas.h" 67 #include "skia/ext/platform_canvas.h"
67 #include "third_party/WebKit/public/platform/WebCursorInfo.h" 68 #include "third_party/WebKit/public/platform/WebCursorInfo.h"
68 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" 69 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
69 #include "third_party/WebKit/public/platform/WebPoint.h" 70 #include "third_party/WebKit/public/platform/WebPoint.h"
70 #include "third_party/WebKit/public/platform/WebRect.h" 71 #include "third_party/WebKit/public/platform/WebRect.h"
71 #include "third_party/WebKit/public/platform/WebScreenInfo.h" 72 #include "third_party/WebKit/public/platform/WebScreenInfo.h"
72 #include "third_party/WebKit/public/platform/WebSize.h" 73 #include "third_party/WebKit/public/platform/WebSize.h"
73 #include "third_party/WebKit/public/platform/WebString.h" 74 #include "third_party/WebKit/public/platform/WebString.h"
74 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" 75 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // framebuffer doesn't need alpha, depth, stencil, antialiasing. 216 // framebuffer doesn't need alpha, depth, stencil, antialiasing.
216 gpu::gles2::ContextCreationAttribHelper attributes; 217 gpu::gles2::ContextCreationAttribHelper attributes;
217 attributes.alpha_size = -1; 218 attributes.alpha_size = -1;
218 attributes.depth_size = 0; 219 attributes.depth_size = 0;
219 attributes.stencil_size = 0; 220 attributes.stencil_size = 0;
220 attributes.samples = 0; 221 attributes.samples = 0;
221 attributes.sample_buffers = 0; 222 attributes.sample_buffers = 0;
222 attributes.bind_generates_resource = false; 223 attributes.bind_generates_resource = false;
223 attributes.lose_context_when_out_of_memory = true; 224 attributes.lose_context_when_out_of_memory = true;
224 225
225 content::WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
226 // The renderer compositor context doesn't do a lot of stuff, so we don't
227 // expect it to need a lot of space for commands or transfer. Raster and
228 // uploads happen on the worker context instead.
229 limits.command_buffer_size = 64 * 1024;
230 limits.start_transfer_buffer_size = 64 * 1024;
231 limits.min_transfer_buffer_size = 64 * 1024;
232
233 bool share_resources = true; 226 bool share_resources = true;
234 bool automatic_flushes = false; 227 bool automatic_flushes = false;
235 228
236 return base::WrapUnique(new content::WebGraphicsContext3DCommandBufferImpl( 229 return base::WrapUnique(new content::WebGraphicsContext3DCommandBufferImpl(
237 gpu::kNullSurfaceHandle, url, gpu_channel_host.get(), attributes, 230 gpu::kNullSurfaceHandle, url, gpu_channel_host.get(), attributes,
238 gfx::PreferIntegratedGpu, share_resources, automatic_flushes, limits, 231 gfx::PreferIntegratedGpu, share_resources, automatic_flushes, nullptr));
239 nullptr));
240 } 232 }
241 233
242 } // namespace 234 } // namespace
243 235
244 namespace content { 236 namespace content {
245 237
246 // RenderWidget --------------------------------------------------------------- 238 // RenderWidget ---------------------------------------------------------------
247 239
248 RenderWidget::RenderWidget(CompositorDependencies* compositor_deps, 240 RenderWidget::RenderWidget(CompositorDependencies* compositor_deps,
249 blink::WebPopupType popup_type, 241 blink::WebPopupType popup_type,
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 vulkan_context_provider = cc::VulkanInProcessContextProvider::Create(); 775 vulkan_context_provider = cc::VulkanInProcessContextProvider::Create();
784 if (vulkan_context_provider) { 776 if (vulkan_context_provider) {
785 uint32_t output_surface_id = next_output_surface_id_++; 777 uint32_t output_surface_id = next_output_surface_id_++;
786 return base::WrapUnique(new DelegatedCompositorOutputSurface( 778 return base::WrapUnique(new DelegatedCompositorOutputSurface(
787 routing_id(), output_surface_id, context_provider, 779 routing_id(), output_surface_id, context_provider,
788 worker_context_provider, vulkan_context_provider, 780 worker_context_provider, vulkan_context_provider,
789 frame_swap_message_queue_)); 781 frame_swap_message_queue_));
790 } 782 }
791 #endif 783 #endif
792 784
785 gpu::SharedMemoryLimits limits;
786 // The renderer compositor context doesn't do a lot of stuff, so we don't
787 // expect it to need a lot of space for commands or transfer. Raster and
788 // uploads happen on the worker context instead.
789 limits.command_buffer_size = 64 * 1024;
790 limits.start_transfer_buffer_size = 64 * 1024;
791 limits.min_transfer_buffer_size = 64 * 1024;
792
793 context_provider = new ContextProviderCommandBuffer( 793 context_provider = new ContextProviderCommandBuffer(
794 CreateOffscreenContext(std::move(gpu_channel_host), 794 CreateOffscreenContext(std::move(gpu_channel_host),
795 GetURLForGraphicsContext3D()), 795 GetURLForGraphicsContext3D()),
796 RENDER_COMPOSITOR_CONTEXT); 796 limits, RENDER_COMPOSITOR_CONTEXT);
797 worker_context_provider = 797 worker_context_provider =
798 RenderThreadImpl::current()->SharedWorkerContextProvider(); 798 RenderThreadImpl::current()->SharedWorkerContextProvider();
799 if (!worker_context_provider) { 799 if (!worker_context_provider) {
800 // Cause the compositor to wait and try again. 800 // Cause the compositor to wait and try again.
801 return nullptr; 801 return nullptr;
802 } 802 }
803 803
804 #if defined(OS_ANDROID) 804 #if defined(OS_ANDROID)
805 if (SynchronousCompositorFactory* factory = 805 if (SynchronousCompositorFactory* factory =
806 SynchronousCompositorFactory::GetInstance()) { 806 SynchronousCompositorFactory::GetInstance()) {
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after
2126 } 2126 }
2127 2127
2128 float RenderWidget::GetOriginalDeviceScaleFactor() const { 2128 float RenderWidget::GetOriginalDeviceScaleFactor() const {
2129 return 2129 return
2130 screen_metrics_emulator_ ? 2130 screen_metrics_emulator_ ?
2131 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : 2131 screen_metrics_emulator_->original_screen_info().deviceScaleFactor :
2132 device_scale_factor_; 2132 device_scale_factor_;
2133 } 2133 }
2134 2134
2135 } // namespace content 2135 } // 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