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

Unified Diff: content/common/gpu/gpu_memory_manager.h

Issue 1420533009: Cleanup GpuMemoryManager and helpers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/gpu_memory_manager.h
diff --git a/content/common/gpu/gpu_memory_manager.h b/content/common/gpu/gpu_memory_manager.h
index cdfd30da970df5a7bd5b9bf79fa7d8f427480c8e..e9be1f939f0898fdc1b28d479227ecfba7b49f97 100644
--- a/content/common/gpu/gpu_memory_manager.h
+++ b/content/common/gpu/gpu_memory_manager.h
@@ -21,44 +21,18 @@
namespace content {
class GpuChannelManager;
-class GpuMemoryManagerClient;
-class GpuMemoryManagerClientState;
class GpuMemoryTrackingGroup;
class CONTENT_EXPORT GpuMemoryManager :
public base::SupportsWeakPtr<GpuMemoryManager> {
public:
-#if defined(OS_ANDROID) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
- enum { kDefaultMaxSurfacesWithFrontbufferSoftLimit = 1 };
-#else
- enum { kDefaultMaxSurfacesWithFrontbufferSoftLimit = 8 };
-#endif
- enum ScheduleManageTime {
- // Add a call to Manage to the thread's message loop immediately.
- kScheduleManageNow,
- // Add a Manage call to the thread's message loop for execution 1/60th of
- // of a second from now.
- kScheduleManageLater,
- };
-
- GpuMemoryManager(GpuChannelManager* channel_manager,
- uint64 max_surfaces_with_frontbuffer_soft_limit);
+ GpuMemoryManager(GpuChannelManager* channel_manager);
piman 2015/11/10 23:34:49 nit: explicit
sohanjg 2015/11/13 07:30:44 Done.
~GpuMemoryManager();
- // Schedule a Manage() call. If immediate is true, we PostTask without delay.
- // Otherwise PostDelayedTask using a CancelableClosure and allow multiple
- // delayed calls to "queue" up. This way, we do not spam clients in certain
- // lower priority situations. An immediate schedule manage will cancel any
- // queued delayed manage.
- void ScheduleManage(ScheduleManageTime schedule_manage_time);
-
// Retrieve GPU Resource consumption statistics for the task manager
void GetVideoMemoryUsageStats(
content::GPUVideoMemoryUsageStats* video_memory_usage_stats) const;
- GpuMemoryManagerClientState* CreateClientState(
- GpuMemoryManagerClient* client, bool has_surface, bool visible);
-
GpuMemoryTrackingGroup* CreateTrackingGroup(
base::ProcessId pid, gpu::gles2::MemoryTracker* memory_tracker);
@@ -72,47 +46,9 @@ class CONTENT_EXPORT GpuMemoryManager :
friend class GpuMemoryTrackingGroup;
friend class GpuMemoryManagerClientState;
- FRIEND_TEST_ALL_PREFIXES(GpuMemoryManagerTest,
- TestManageBasicFunctionality);
- FRIEND_TEST_ALL_PREFIXES(GpuMemoryManagerTest,
- TestManageChangingVisibility);
- FRIEND_TEST_ALL_PREFIXES(GpuMemoryManagerTest,
- TestManageManyVisibleStubs);
- FRIEND_TEST_ALL_PREFIXES(GpuMemoryManagerTest,
- TestManageManyNotVisibleStubs);
- FRIEND_TEST_ALL_PREFIXES(GpuMemoryManagerTest,
- TestManageChangingLastUsedTime);
- FRIEND_TEST_ALL_PREFIXES(GpuMemoryManagerTest,
- TestManageChangingImportanceShareGroup);
- FRIEND_TEST_ALL_PREFIXES(GpuMemoryManagerTest,
- TestForegroundStubsGetBonusAllocation);
- FRIEND_TEST_ALL_PREFIXES(GpuMemoryManagerTest,
- TestUpdateAvailableGpuMemory);
- FRIEND_TEST_ALL_PREFIXES(GpuMemoryManagerTest,
- GpuMemoryAllocationCompareTests);
- FRIEND_TEST_ALL_PREFIXES(GpuMemoryManagerTest,
- StubMemoryStatsForLastManageTests);
- FRIEND_TEST_ALL_PREFIXES(GpuMemoryManagerTest,
- TestManagedUsageTracking);
- FRIEND_TEST_ALL_PREFIXES(GpuMemoryManagerTest,
- BackgroundMru);
- FRIEND_TEST_ALL_PREFIXES(GpuMemoryManagerTest,
- AllowNonvisibleMemory);
- FRIEND_TEST_ALL_PREFIXES(GpuMemoryManagerTest,
- BackgroundDiscardPersistent);
- FRIEND_TEST_ALL_PREFIXES(GpuMemoryManagerTest,
- UnmanagedTracking);
- FRIEND_TEST_ALL_PREFIXES(GpuMemoryManagerTest,
- DefaultAllocation);
-
typedef std::map<gpu::gles2::MemoryTracker*, GpuMemoryTrackingGroup*>
TrackingGroupMap;
- typedef std::list<GpuMemoryManagerClientState*> ClientStateList;
-
- void Manage();
- void SetClientsHibernatedState() const;
-
// Send memory usage stats to the browser process.
void SendUmaStatsToBrowser();
@@ -129,39 +65,11 @@ class CONTENT_EXPORT GpuMemoryManager :
void OnDestroyTrackingGroup(GpuMemoryTrackingGroup* tracking_group);
bool EnsureGPUMemoryAvailable(uint64 size_needed);
- // GpuMemoryManagerClientState interface
- void SetClientStateVisible(
- GpuMemoryManagerClientState* client_state, bool visible);
- void OnDestroyClientState(GpuMemoryManagerClientState* client);
-
- // Add or remove a client from its clients list (visible, nonvisible, or
- // nonsurface). When adding the client, add it to the front of the list.
- void AddClientToList(GpuMemoryManagerClientState* client_state);
- void RemoveClientFromList(GpuMemoryManagerClientState* client_state);
- ClientStateList* GetClientList(GpuMemoryManagerClientState* client_state);
-
- // Interfaces for testing
- void TestingDisableScheduleManage() { disable_schedule_manage_ = true; }
-
GpuChannelManager* channel_manager_;
- // A list of all visible and nonvisible clients, in most-recently-used
- // order (most recently used is first).
- ClientStateList clients_visible_mru_;
- ClientStateList clients_nonvisible_mru_;
-
- // A list of all clients that don't have a surface.
- ClientStateList clients_nonsurface_;
-
// All context groups' tracking structures
TrackingGroupMap tracking_groups_;
- base::CancelableClosure delayed_manage_callback_;
- bool manage_immediate_scheduled_;
- bool disable_schedule_manage_;
-
- uint64 max_surfaces_with_frontbuffer_soft_limit_;
-
// The maximum amount of memory that may be allocated for a single client.
uint64 client_hard_limit_bytes_;

Powered by Google App Engine
This is Rietveld 408576698