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

Unified Diff: third_party/WebKit/Source/platform/PurgeableVector.h

Issue 2253853002: Remove SharedBuffer::unlock() and keep Resource's SharedBuffer always locked (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use hasClientsOrObservers() for live_size Created 4 years, 4 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
Index: third_party/WebKit/Source/platform/PurgeableVector.h
diff --git a/third_party/WebKit/Source/platform/PurgeableVector.h b/third_party/WebKit/Source/platform/PurgeableVector.h
index fd8b1e713dbccef0fe81648050d8ae97260be1eb..ef4baaaf0807ba6a18c5003c0b1e9889b6c4ab38 100644
--- a/third_party/WebKit/Source/platform/PurgeableVector.h
+++ b/third_party/WebKit/Source/platform/PurgeableVector.h
@@ -46,10 +46,9 @@ namespace blink {
class WebProcessMemoryDump;
-// A simple vector implementation that supports purgeable memory. The vector is
-// already locked at construction and locking uses an internal counter which
-// means that N calls to lock() must be followed by N+1 calls to unlock() to
-// actually make the vector purgeable.
+// A simple vector implementation that supports purgeable memory.
+// TODO(hiroshige): PurgeableVector is about to be removed and some
+// functionality has already been removed https://crbug.com/603791.
class PLATFORM_EXPORT PurgeableVector {
DISALLOW_NEW();
WTF_MAKE_NONCOPYABLE(PurgeableVector);
@@ -59,16 +58,10 @@ public:
Purgeable,
};
- // Clients who know in advance that they will call unlock() should construct
- // the instance with the Purgeable option so that the instance uses
- // discardable memory from the start and unlock() doesn't cause a memcpy().
PurgeableVector(PurgeableOption = Purgeable);
~PurgeableVector();
- // WARNING: This causes a memcpy() if the instance was constructed with the
- // Purgeable hint or had its internal vector moved to discardable memory
- // after a call to unlock().
void adopt(Vector<char>& other);
void append(const char* data, size_t length);
@@ -77,20 +70,10 @@ public:
void clear();
- // The instance must be locked before calling this.
char* data();
size_t size() const;
- // Returns whether the memory is still resident.
- bool lock();
-
- // WARNING: Calling unlock() on an instance that wasn't created with the
- // Purgeable option does an extra memcpy().
- void unlock();
-
- bool isLocked() const;
-
// Note that this method should be used carefully since it may not use
// exponential growth internally. This means that repeated/invalid uses of
// it can result in O(N^2) append(). If you don't exactly know what you are
@@ -124,7 +107,6 @@ private:
size_t m_discardableCapacity;
size_t m_discardableSize;
bool m_isPurgeable;
- int m_locksCount;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698