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

Unified Diff: cc/tiles/gpu_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/gpu_image_decode_controller.h ('k') | cc/tiles/software_image_decode_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/gpu_image_decode_controller.cc
diff --git a/cc/tiles/gpu_image_decode_controller.cc b/cc/tiles/gpu_image_decode_controller.cc
index 405879e9f65abf76460441306366a9df3a84bd41..69d54594e1e60620d8408d1dffc0d24d6eb7de90 100644
--- a/cc/tiles/gpu_image_decode_controller.cc
+++ b/cc/tiles/gpu_image_decode_controller.cc
@@ -7,6 +7,7 @@
#include <inttypes.h>
#include "base/memory/discardable_memory_allocator.h"
+#include "base/memory/memory_coordinator_client_registry.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_math.h"
@@ -348,6 +349,8 @@ GpuImageDecodeController::GpuImageDecodeController(ContextProvider* context,
this, "cc::GpuImageDecodeController",
base::ThreadTaskRunnerHandle::Get());
}
+ // Register this component with base::MemoryCoordinatorClientRegistry.
+ base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this);
}
GpuImageDecodeController::~GpuImageDecodeController() {
@@ -358,6 +361,8 @@ GpuImageDecodeController::~GpuImageDecodeController() {
// 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 GpuImageDecodeController::GetTaskForImageAndRef(
@@ -1174,4 +1179,23 @@ bool GpuImageDecodeController::DiscardableIsLockedForTesting(
return image_data->decode.is_locked();
}
+void GpuImageDecodeController::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/gpu_image_decode_controller.h ('k') | cc/tiles/software_image_decode_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698