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

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

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.cpp
diff --git a/third_party/WebKit/Source/platform/PurgeableVector.cpp b/third_party/WebKit/Source/platform/PurgeableVector.cpp
index 5c42bd15214231f23dd2e62c67de3e2785dc65a3..9fa9aa0309786b085f1e576ea2f65921c20b4edd 100644
--- a/third_party/WebKit/Source/platform/PurgeableVector.cpp
+++ b/third_party/WebKit/Source/platform/PurgeableVector.cpp
@@ -50,7 +50,6 @@ PurgeableVector::PurgeableVector(PurgeableOption purgeable)
: m_discardableCapacity(0)
, m_discardableSize(0)
, m_isPurgeable(purgeable == Purgeable)
- , m_locksCount(1) // The buffer is locked at creation.
{
}
@@ -60,8 +59,6 @@ PurgeableVector::~PurgeableVector()
void PurgeableVector::reserveCapacity(size_t capacity)
{
- ASSERT(isLocked());
-
if (m_isPurgeable) {
if (reservePurgeableCapacity(capacity, UseExactCapacity))
return;
@@ -110,8 +107,6 @@ void PurgeableVector::clearDiscardable()
void PurgeableVector::append(const char* data, size_t length)
{
- ASSERT(isLocked());
-
if (!m_isPurgeable) {
m_vector.append(data, length);
return;
@@ -154,7 +149,6 @@ void PurgeableVector::clear()
char* PurgeableVector::data()
{
- ASSERT(isLocked());
return m_discardable ? static_cast<char*>(m_discardable->data()) : m_vector.data();
}
@@ -180,43 +174,6 @@ void PurgeableVector::adopt(Vector<char>& other)
other.clear();
}
-bool PurgeableVector::lock()
-{
- ++m_locksCount;
- if (m_locksCount > 1)
- return true;
-
- ASSERT(m_locksCount == 1);
- if (!m_discardable)
- return true;
-
- return m_discardable->Lock();
-}
-
-void PurgeableVector::unlock()
-{
- ASSERT(isLocked());
- --m_locksCount;
- if (m_locksCount > 0)
- return;
-
- if (!m_vector.isEmpty()) {
- ASSERT(!m_discardable);
- m_isPurgeable = true;
- if (!reservePurgeableCapacity(m_vector.size(), UseExactCapacity))
- return;
- }
-
- if (m_discardable)
- m_discardable->Unlock();
-}
-
-bool PurgeableVector::isLocked() const
-{
- ASSERT(m_locksCount >= 0);
- return m_locksCount > 0;
-}
-
bool PurgeableVector::reservePurgeableCapacity(size_t capacity, PurgeableAllocationStrategy allocationStrategy)
{
ASSERT(m_isPurgeable);
« no previous file with comments | « third_party/WebKit/Source/platform/PurgeableVector.h ('k') | third_party/WebKit/Source/platform/PurgeableVectorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698