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

Unified Diff: gpu/command_buffer/client/mapped_memory.cc

Issue 1900993002: Move SharedMemoryLimits out of WebGraphicsContext3DCommandBufferImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@limits
Patch Set: move-limits: rebase 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: gpu/command_buffer/client/mapped_memory.cc
diff --git a/gpu/command_buffer/client/mapped_memory.cc b/gpu/command_buffer/client/mapped_memory.cc
index c40278e27203cfba27bb5b2f8deddb17c7d0698d..c2906c2724ed35771faa22f90ddf4514a5ab960d 100644
--- a/gpu/command_buffer/client/mapped_memory.cc
+++ b/gpu/command_buffer/client/mapped_memory.cc
@@ -17,6 +17,7 @@
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/trace_event.h"
#include "gpu/command_buffer/client/cmd_buffer_helper.h"
+#include "gpu/command_buffer/client/shared_memory_limits.h"
#include "gpu/command_buffer/common/buffer.h"
namespace gpu {
@@ -43,7 +44,7 @@ MappedMemoryManager::MappedMemoryManager(CommandBufferHelper* helper,
helper_(helper),
allocated_memory_(0),
max_free_bytes_(unused_memory_reclaim_limit),
- max_allocated_bytes_(kNoLimit),
+ max_allocated_bytes_(SharedMemoryLimits::kNoLimit),
tracing_id_(g_next_mapped_memory_manager_tracing_id.GetNext()) {
// In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview).
// Don't register a dump provider in these cases.
@@ -87,7 +88,7 @@ void* MappedMemoryManager::Alloc(unsigned int size,
// If there is a memory limit being enforced and total free
// memory (allocated_memory_ - total_bytes_in_use) is larger than
// the limit try waiting.
- if (max_free_bytes_ != kNoLimit &&
+ if (max_free_bytes_ != SharedMemoryLimits::kNoLimit &&
(allocated_memory_ - total_bytes_in_use) >= max_free_bytes_) {
TRACE_EVENT0("gpu", "MappedMemoryManager::Alloc::wait");
for (auto& chunk : chunks_) {
@@ -102,7 +103,7 @@ void* MappedMemoryManager::Alloc(unsigned int size,
}
}
- if (max_allocated_bytes_ != kNoLimit &&
+ if (max_allocated_bytes_ != SharedMemoryLimits::kNoLimit &&
(allocated_memory_ + size) > max_allocated_bytes_) {
return nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698