Chromium Code Reviews| Index: content/renderer/render_widget.cc |
| diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc |
| index 53b8839462b97f2a6fd47a3cf42e0887bef3b4d8..2e8b36ed11c3ae798cf9422ac95b1d78acc0c1a6 100644 |
| --- a/content/renderer/render_widget.cc |
| +++ b/content/renderer/render_widget.cc |
| @@ -640,7 +640,8 @@ bool RenderWidget::ForceCompositingModeEnabled() { |
| return false; |
| } |
| -scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) { |
| +scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface( |
| + bool fallback, size_t max_bytes_pending_upload) { |
| const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| #if defined(OS_ANDROID) |
| @@ -673,7 +674,7 @@ scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) { |
| scoped_refptr<ContextProviderCommandBuffer> context_provider; |
| if (!fallback) { |
| context_provider = ContextProviderCommandBuffer::Create( |
| - CreateGraphicsContext3D(attributes)); |
| + CreateGraphicsContext3D(attributes, max_bytes_pending_upload)); |
| } |
| if (!context_provider.get()) { |
| @@ -2526,7 +2527,8 @@ bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { |
| scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
| RenderWidget::CreateGraphicsContext3D( |
| - const WebKit::WebGraphicsContext3D::Attributes& attributes) { |
| + const WebKit::WebGraphicsContext3D::Attributes& attributes, |
| + size_t max_bytes_pending_upload) { |
| if (!webwidget_) |
| return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); |
| if (CommandLine::ForCurrentProcess()->HasSwitch( |
| @@ -2539,10 +2541,17 @@ RenderWidget::CreateGraphicsContext3D( |
| RenderThreadImpl::current(), |
| weak_ptr_factory_.GetWeakPtr())); |
| - if (!context->InitializeWithDefaultBufferSizes( |
| + const size_t kMappedMemoryReclaimLimit = max_bytes_pending_upload / 4; |
|
reveman
2013/08/22 15:32:34
this needs to be explained. why divide by 4 and no
|
| + |
| + if (!context->Initialize( |
| attributes, |
| false /* bind generates resources */, |
| - CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)) |
| + CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE, |
| + kDefaultCommandBufferSize, |
| + kDefaultStartTransferBufferSize, |
| + kDefaultMinTransferBufferSize, |
| + kDefaultMaxTransferBufferSize, |
| + kMappedMemoryReclaimLimit)) |
| return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); |
| return context.Pass(); |
| } |