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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.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/browser/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 attributes.depth_size = 0; 163 attributes.depth_size = 0;
164 attributes.samples = 0; 164 attributes.samples = 0;
165 attributes.sample_buffers = 0; 165 attributes.sample_buffers = 0;
166 attributes.bind_generates_resource = false; 166 attributes.bind_generates_resource = false;
167 167
168 static const size_t kBytesPerPixel = 4; 168 static const size_t kBytesPerPixel = 4;
169 gfx::DeviceDisplayInfo display_info; 169 gfx::DeviceDisplayInfo display_info;
170 size_t full_screen_texture_size_in_bytes = display_info.GetDisplayHeight() * 170 size_t full_screen_texture_size_in_bytes = display_info.GetDisplayHeight() *
171 display_info.GetDisplayWidth() * 171 display_info.GetDisplayWidth() *
172 kBytesPerPixel; 172 kBytesPerPixel;
173 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; 173 gpu::SharedMemoryLimits limits;
174 limits.command_buffer_size = 64 * 1024; 174 limits.command_buffer_size = 64 * 1024;
175 limits.start_transfer_buffer_size = 64 * 1024; 175 limits.start_transfer_buffer_size = 64 * 1024;
176 limits.min_transfer_buffer_size = 64 * 1024; 176 limits.min_transfer_buffer_size = 64 * 1024;
177 limits.max_transfer_buffer_size = std::min( 177 limits.max_transfer_buffer_size = std::min(
178 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize); 178 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize);
179 limits.mapped_memory_reclaim_limit =
180 WebGraphicsContext3DCommandBufferImpl::kNoLimit;
181 179
182 bool share_resources = true; 180 bool share_resources = true;
183 // TODO(danakj): This should be false probably, it is for the main thread 181 // TODO(danakj): This should be false probably, it is for the main thread
184 // context which is used for GLHelper. 182 // context which is used for GLHelper.
185 bool automatic_flushes = true; 183 bool automatic_flushes = true;
186 GURL url("chrome://gpu/RenderWidgetHostViewAndroid"); 184 GURL url("chrome://gpu/RenderWidgetHostViewAndroid");
187 185
188 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> context( 186 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> context(
189 new WebGraphicsContext3DCommandBufferImpl( 187 new WebGraphicsContext3DCommandBufferImpl(
190 gpu::kNullSurfaceHandle, // offscreen 188 gpu::kNullSurfaceHandle, // offscreen
191 url, gpu_channel_host.get(), attributes, gfx::PreferIntegratedGpu, 189 url, gpu_channel_host.get(), attributes, gfx::PreferIntegratedGpu,
192 share_resources, automatic_flushes, limits, nullptr)); 190 share_resources, automatic_flushes, nullptr));
193 provider_ = new ContextProviderCommandBuffer( 191 provider_ = new ContextProviderCommandBuffer(
194 std::move(context), BROWSER_OFFSCREEN_MAINTHREAD_CONTEXT); 192 std::move(context), limits, BROWSER_OFFSCREEN_MAINTHREAD_CONTEXT);
195 if (!provider_->BindToCurrentThread()) 193 if (!provider_->BindToCurrentThread())
196 return; 194 return;
197 provider_->ContextGL()->TraceBeginCHROMIUM( 195 provider_->ContextGL()->TraceBeginCHROMIUM(
198 "gpu_toplevel", 196 "gpu_toplevel",
199 base::StringPrintf("CmdBufferImageTransportFactory-%p", provider_.get()) 197 base::StringPrintf("CmdBufferImageTransportFactory-%p", provider_.get())
200 .c_str()); 198 .c_str());
201 provider_->SetLostContextCallback( 199 provider_->SetLostContextCallback(
202 base::Bind(&GLHelperHolder::OnContextLost, base::Unretained(this))); 200 base::Bind(&GLHelperHolder::OnContextLost, base::Unretained(this)));
203 gl_helper_.reset( 201 gl_helper_.reset(
204 new GLHelper(provider_->ContextGL(), provider_->ContextSupport())); 202 new GLHelper(provider_->ContextGL(), provider_->ContextSupport()));
(...skipping 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after
2018 results->orientationAngle = display.RotationAsDegree(); 2016 results->orientationAngle = display.RotationAsDegree();
2019 results->orientationType = 2017 results->orientationType =
2020 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); 2018 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
2021 gfx::DeviceDisplayInfo info; 2019 gfx::DeviceDisplayInfo info;
2022 results->depth = info.GetBitsPerPixel(); 2020 results->depth = info.GetBitsPerPixel();
2023 results->depthPerComponent = info.GetBitsPerComponent(); 2021 results->depthPerComponent = info.GetBitsPerComponent();
2024 results->isMonochrome = (results->depthPerComponent == 0); 2022 results->isMonochrome = (results->depthPerComponent == 0);
2025 } 2023 }
2026 2024
2027 } // namespace content 2025 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/compositor_impl_android.cc ('k') | content/common/gpu/client/context_provider_command_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698