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

Unified Diff: cc/raster/staging_buffer_pool.cc

Issue 2286583002: Make cc::SoftwareImageDecodeController, cc::ResourcePool, and cc::StagingBufferPoo… (Closed)
Patch Set: Patch for landing Created 4 years, 3 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
« no previous file with comments | « cc/raster/staging_buffer_pool.h ('k') | cc/resources/resource_pool.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/raster/staging_buffer_pool.cc
diff --git a/cc/raster/staging_buffer_pool.cc b/cc/raster/staging_buffer_pool.cc
index ade400d9906ad3c07a5b92280775f3c91644e6ab..9f2eeffee7679bbfd36ba2d9b5cb42fefd4aff23 100644
--- a/cc/raster/staging_buffer_pool.cc
+++ b/cc/raster/staging_buffer_pool.cc
@@ -6,6 +6,7 @@
#include <memory>
+#include "base/memory/memory_coordinator_client_registry.h"
#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -141,11 +142,16 @@ StagingBufferPool::StagingBufferPool(base::SequencedTaskRunner* task_runner,
this, "cc::StagingBufferPool", base::ThreadTaskRunnerHandle::Get());
reduce_memory_usage_callback_ = base::Bind(
&StagingBufferPool::ReduceMemoryUsage, weak_ptr_factory_.GetWeakPtr());
+
+ // Register this component with base::MemoryCoordinatorClientRegistry.
+ base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this);
}
StagingBufferPool::~StagingBufferPool() {
base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
this);
+ // Unregister this component with memory_coordinator::ClientRegistry.
+ base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(this);
}
void StagingBufferPool::Shutdown() {
@@ -409,4 +415,23 @@ void StagingBufferPool::ReleaseBuffersNotUsedSince(base::TimeTicks time) {
}
}
+void StagingBufferPool::OnMemoryStateChange(base::MemoryState state) {
+ switch (state) {
+ case base::MemoryState::NORMAL:
+ // TODO(tasak): go back to normal state.
+ break;
+ case base::MemoryState::THROTTLED:
+ // TODO(tasak): make the limits of this component's caches smaller to
+ // save memory usage.
+ break;
+ case base::MemoryState::SUSPENDED:
+ // TODO(tasak): free this component's caches as much as possible before
+ // suspending renderer.
+ break;
+ case base::MemoryState::UNKNOWN:
+ // NOT_REACHED.
+ break;
+ }
+}
+
} // namespace cc
« no previous file with comments | « cc/raster/staging_buffer_pool.h ('k') | cc/resources/resource_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698