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

Unified Diff: components/html_viewer/discardable_memory_allocator.h

Issue 1189833005: Revert of Support impl-side painting in Mandoline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « components/html_viewer/BUILD.gn ('k') | components/html_viewer/discardable_memory_allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/html_viewer/discardable_memory_allocator.h
diff --git a/components/html_viewer/discardable_memory_allocator.h b/components/html_viewer/discardable_memory_allocator.h
index 9be0e212d1982628cfc8a08b0d881232a320035d..be7f063ef9064fb9e3dcaa2fc87057bfd7b3570a 100644
--- a/components/html_viewer/discardable_memory_allocator.h
+++ b/components/html_viewer/discardable_memory_allocator.h
@@ -8,7 +8,6 @@
#include <list>
#include "base/memory/discardable_memory_allocator.h"
-#include "base/synchronization/lock.h"
namespace html_viewer {
@@ -16,6 +15,8 @@
// allocations.
class DiscardableMemoryAllocator : public base::DiscardableMemoryAllocator {
public:
+ class OwnedMemoryChunk;
+
explicit DiscardableMemoryAllocator(size_t desired_max_memory);
~DiscardableMemoryAllocator() override;
@@ -24,31 +25,22 @@
size_t size) override;
private:
- class DiscardableMemoryChunkImpl;
- friend class DiscardableMemoryChunkImpl;
+ friend class OwnedMemoryChunk;
- // Called by DiscardableMemoryChunkImpl when they are unlocked. This puts them
- // at the end of the live_unlocked_chunks_ list and passes an iterator to
- // their position in the unlocked chunk list.
- std::list<DiscardableMemoryChunkImpl*>::iterator NotifyUnlocked(
- DiscardableMemoryChunkImpl* chunk);
+ // Called by OwnedMemoryChunks when they are unlocked. This puts them at the
+ // end of the live_unlocked_chunks_ list and passes an iterator to their
+ // position in the unlocked chunk list.
+ std::list<OwnedMemoryChunk*>::iterator NotifyUnlocked(
+ OwnedMemoryChunk* chunk);
- // Called by DiscardableMemoryChunkImpl when they are locked. This removes the
- // passed in unlocked chunk list.
- void NotifyLocked(std::list<DiscardableMemoryChunkImpl*>::iterator it);
-
- // Called by DiscardableMemoryChunkImpl when it's destructed. It must be
- // unlocked, by definition.
- void NotifyDestructed(std::list<DiscardableMemoryChunkImpl*>::iterator it);
+ // Called by OwnedMemoryChunks when they are locked. This removes the passed
+ // in unlocked chunk list.
+ void NotifyLocked(std::list<OwnedMemoryChunk*>::iterator it);
// The amount of memory we can allocate before we try to free unlocked
// chunks. We can go over this amount if all callers keep their discardable
// chunks locked.
const size_t desired_max_memory_;
-
- // Protects all members below, since this class can be called on the main
- // thread and impl side painting raster threads.
- base::Lock lock_;
// A count of the sum of memory. Used to trigger discarding the oldest
// memory.
@@ -59,7 +51,7 @@
// A linked list of unlocked allocated chunks so that the tail is most
// recently accessed chunks.
- std::list<DiscardableMemoryChunkImpl*> live_unlocked_chunks_;
+ std::list<OwnedMemoryChunk*> live_unlocked_chunks_;
DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryAllocator);
};
« no previous file with comments | « components/html_viewer/BUILD.gn ('k') | components/html_viewer/discardable_memory_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698