| OLD | NEW |
| 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 Loading... |
| 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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 } | 777 } |
| 779 | 778 |
| 780 gpu::SharedMemoryLimits limits; | 779 gpu::SharedMemoryLimits limits; |
| 781 // The renderer compositor context doesn't do a lot of stuff, so we don't | 780 // The renderer compositor context doesn't do a lot of stuff, so we don't |
| 782 // expect it to need a lot of space for commands or transfer. Raster and | 781 // expect it to need a lot of space for commands or transfer. Raster and |
| 783 // uploads happen on the worker context instead. | 782 // uploads happen on the worker context instead. |
| 784 limits.command_buffer_size = 64 * 1024; | 783 limits.command_buffer_size = 64 * 1024; |
| 785 limits.start_transfer_buffer_size = 64 * 1024; | 784 limits.start_transfer_buffer_size = 64 * 1024; |
| 786 limits.min_transfer_buffer_size = 64 * 1024; | 785 limits.min_transfer_buffer_size = 64 * 1024; |
| 787 | 786 |
| 788 context_provider = new ContextProviderCommandBuffer( | |
| 789 CreateOffscreenContext(std::move(gpu_channel_host), | |
| 790 GetURLForGraphicsContext3D()), | |
| 791 limits, RENDER_COMPOSITOR_CONTEXT); | |
| 792 worker_context_provider = | 787 worker_context_provider = |
| 793 RenderThreadImpl::current()->SharedWorkerContextProvider(); | 788 RenderThreadImpl::current()->SharedWorkerContextProvider(); |
| 794 if (!worker_context_provider) { | 789 if (!worker_context_provider) { |
| 795 // Cause the compositor to wait and try again. | 790 // Cause the compositor to wait and try again. |
| 796 return nullptr; | 791 return nullptr; |
| 797 } | 792 } |
| 798 | 793 |
| 794 // The compositor context shares resources with the worker context. |
| 795 context_provider = new ContextProviderCommandBuffer( |
| 796 CreateOffscreenContext(std::move(gpu_channel_host), |
| 797 GetURLForGraphicsContext3D()), |
| 798 limits, worker_context_provider.get(), RENDER_COMPOSITOR_CONTEXT); |
| 799 |
| 799 #if defined(OS_ANDROID) | 800 #if defined(OS_ANDROID) |
| 800 if (RenderThreadImpl::current() && | 801 if (RenderThreadImpl::current() && |
| 801 RenderThreadImpl::current()->sync_compositor_message_filter()) { | 802 RenderThreadImpl::current()->sync_compositor_message_filter()) { |
| 802 uint32_t output_surface_id = next_output_surface_id_++; | 803 uint32_t output_surface_id = next_output_surface_id_++; |
| 803 return base::WrapUnique(new SynchronousCompositorOutputSurface( | 804 return base::WrapUnique(new SynchronousCompositorOutputSurface( |
| 804 context_provider, worker_context_provider, routing_id(), | 805 context_provider, worker_context_provider, routing_id(), |
| 805 output_surface_id, | 806 output_surface_id, |
| 806 RenderThreadImpl::current()->sync_compositor_message_filter(), | 807 RenderThreadImpl::current()->sync_compositor_message_filter(), |
| 807 frame_swap_message_queue_)); | 808 frame_swap_message_queue_)); |
| 808 } | 809 } |
| (...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2111 } | 2112 } |
| 2112 | 2113 |
| 2113 float RenderWidget::GetOriginalDeviceScaleFactor() const { | 2114 float RenderWidget::GetOriginalDeviceScaleFactor() const { |
| 2114 return | 2115 return |
| 2115 screen_metrics_emulator_ ? | 2116 screen_metrics_emulator_ ? |
| 2116 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : | 2117 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : |
| 2117 device_scale_factor_; | 2118 device_scale_factor_; |
| 2118 } | 2119 } |
| 2119 | 2120 |
| 2120 } // namespace content | 2121 } // namespace content |
| OLD | NEW |