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

Unified Diff: cc/tiles/software_image_decode_controller.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/tiles/software_image_decode_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/software_image_decode_controller.cc
diff --git a/cc/tiles/software_image_decode_controller.cc b/cc/tiles/software_image_decode_controller.cc
index 34f5f7244d70ebcd28852495799ad852493b46d2..bca4e99010465dde00a3a517f0164d4ecdca1f33 100644
--- a/cc/tiles/software_image_decode_controller.cc
+++ b/cc/tiles/software_image_decode_controller.cc
@@ -13,6 +13,7 @@
#include "base/format_macros.h"
#include "base/macros.h"
#include "base/memory/discardable_memory.h"
+#include "base/memory/memory_coordinator_client_registry.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/stringprintf.h"
@@ -180,6 +181,8 @@ SoftwareImageDecodeController::SoftwareImageDecodeController(
this, "cc::SoftwareImageDecodeController",
base::ThreadTaskRunnerHandle::Get());
}
+ // Register this component with base::MemoryCoordinatorClientRegistry.
+ base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this);
}
SoftwareImageDecodeController::~SoftwareImageDecodeController() {
@@ -189,6 +192,8 @@ SoftwareImageDecodeController::~SoftwareImageDecodeController() {
// It is safe to unregister, even if we didn't register in the constructor.
base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
this);
+ // Unregister this component with memory_coordinator::ClientRegistry.
+ base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(this);
}
bool SoftwareImageDecodeController::GetTaskForImageAndRef(
@@ -1078,4 +1083,24 @@ size_t SoftwareImageDecodeController::MemoryBudget::GetCurrentUsageSafe()
return current_usage_bytes_.ValueOrDie();
}
+void SoftwareImageDecodeController::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/tiles/software_image_decode_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698