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

Unified Diff: content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
index c9c4cf12fad340e1c4d68cd2377a16e25afd818c..fa3a16f1fc034c53ca764110ee090b5e87210efb 100644
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
@@ -29,6 +29,7 @@
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/client/gles2_trace_implementation.h"
#include "gpu/command_buffer/client/gpu_switches.h"
+#include "gpu/command_buffer/client/shared_memory_limits.h"
#include "gpu/command_buffer/client/transfer_buffer.h"
#include "gpu/command_buffer/common/constants.h"
#include "gpu/command_buffer/common/gpu_memory_allocation.h"
@@ -68,13 +69,6 @@ GetDefaultShareGroupForHost(gpu::GpuChannelHost* host) {
} // namespace anonymous
-WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits::SharedMemoryLimits()
- : command_buffer_size(kDefaultCommandBufferSize),
- start_transfer_buffer_size(kDefaultStartTransferBufferSize),
- min_transfer_buffer_size(kDefaultMinTransferBufferSize),
- max_transfer_buffer_size(kDefaultMaxTransferBufferSize),
- mapped_memory_reclaim_limit(gpu::gles2::GLES2Implementation::kNoLimit) {}
-
WebGraphicsContext3DCommandBufferImpl::ShareGroup::ShareGroup() {
}
@@ -90,7 +84,6 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl(
gfx::GpuPreference gpu_preference,
bool share_resources,
bool automatic_flushes,
- const SharedMemoryLimits& limits,
WebGraphicsContext3DCommandBufferImpl* share_context)
: automatic_flushes_(automatic_flushes),
attributes_(attributes),
@@ -98,7 +91,6 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl(
surface_handle_(surface_handle),
active_url_(active_url),
gpu_preference_(gpu_preference),
- mem_limits_(limits),
weak_ptr_factory_(this) {
DCHECK(host);
switch (attributes.context_type) {
@@ -127,7 +119,8 @@ WebGraphicsContext3DCommandBufferImpl::
Destroy();
}
-bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() {
+bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL(
+ const gpu::SharedMemoryLimits& memory_limits) {
if (initialized_)
return true;
@@ -141,7 +134,7 @@ bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() {
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"125248 WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL"));
- if (!CreateContext()) {
+ if (!CreateContext(memory_limits)) {
Destroy();
initialize_failed_ = true;
@@ -199,7 +192,8 @@ bool WebGraphicsContext3DCommandBufferImpl::InitializeCommandBuffer(
return result;
}
-bool WebGraphicsContext3DCommandBufferImpl::CreateContext() {
+bool WebGraphicsContext3DCommandBufferImpl::CreateContext(
+ const gpu::SharedMemoryLimits& memory_limits) {
TRACE_EVENT0("gpu", "WebGfxCtx3DCmdBfrImpl::CreateContext");
scoped_refptr<gpu::gles2::ShareGroup> gles2_share_group;
@@ -224,7 +218,7 @@ bool WebGraphicsContext3DCommandBufferImpl::CreateContext() {
// Create the GLES2 helper, which writes the command buffer protocol.
gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer_.get()));
- if (!gles2_helper_->Initialize(mem_limits_.command_buffer_size)) {
+ if (!gles2_helper_->Initialize(memory_limits.command_buffer_size)) {
LOG(ERROR) << "Failed to initialize GLES2CmdHelper.";
return false;
}
@@ -249,11 +243,10 @@ bool WebGraphicsContext3DCommandBufferImpl::CreateContext() {
support_client_side_arrays, command_buffer_.get()));
SetGLInterface(real_gl_.get());
- if (!real_gl_->Initialize(
- mem_limits_.start_transfer_buffer_size,
- mem_limits_.min_transfer_buffer_size,
- mem_limits_.max_transfer_buffer_size,
- mem_limits_.mapped_memory_reclaim_limit)) {
+ if (!real_gl_->Initialize(memory_limits.start_transfer_buffer_size,
+ memory_limits.min_transfer_buffer_size,
+ memory_limits.max_transfer_buffer_size,
+ memory_limits.mapped_memory_reclaim_limit)) {
LOG(ERROR) << "Failed to initialize GLES2Implementation.";
return false;
}
@@ -269,8 +262,9 @@ bool WebGraphicsContext3DCommandBufferImpl::CreateContext() {
return true;
}
-bool WebGraphicsContext3DCommandBufferImpl::InitializeOnCurrentThread() {
- if (!MaybeInitializeGL()) {
+bool WebGraphicsContext3DCommandBufferImpl::InitializeOnCurrentThread(
+ const gpu::SharedMemoryLimits& memory_limits) {
+ if (!MaybeInitializeGL(memory_limits)) {
DLOG(ERROR) << "Failed to initialize context.";
return false;
}

Powered by Google App Engine
This is Rietveld 408576698