Index: third_party/WebKit/Source/core/fetch/Resource.h |
diff --git a/third_party/WebKit/Source/core/fetch/Resource.h b/third_party/WebKit/Source/core/fetch/Resource.h |
index 02b238927bb2a71c675b2c57e7b01f890ca571a3..86e6185daaabdce9fe726b664f7f41baedc58afe 100644 |
--- a/third_party/WebKit/Source/core/fetch/Resource.h |
+++ b/third_party/WebKit/Source/core/fetch/Resource.h |
@@ -169,7 +169,24 @@ class CORE_EXPORT Resource : public GarbageCollectedFinalized<Resource>, |
void setStatus(Status status) { m_status = status; } |
size_t size() const { return encodedSize() + decodedSize() + overheadSize(); } |
+ |
+ // Returns the size of content (response body) before decoding. Adding a new |
+ // usage of this function is not recommended (See the TODO below). |
+ // |
+ // TODO(hiroshige): Now encodedSize/decodedSize states are inconsistent and |
+ // need to be refactored (crbug/643135). |
size_t encodedSize() const { return m_encodedSize; } |
+ |
+ // Returns the current memory usage for the encoded data. Adding a new usage |
+ // of this function is not recommended as the same reason as |encodedSize()|. |
+ // |
+ // |encodedSize()| and |encodedSizeMemoryUsageForTesting()| can return |
+ // different values, e.g., when ImageResource purges encoded image data after |
+ // finishing loading. |
+ size_t encodedSizeMemoryUsageForTesting() const { |
+ return m_encodedSizeMemoryUsage; |
+ } |
+ |
size_t decodedSize() const { return m_decodedSize; } |
size_t overheadSize() const { return m_overheadSize; } |
@@ -319,6 +336,7 @@ class CORE_EXPORT Resource : public GarbageCollectedFinalized<Resource>, |
virtual void destroyDecodedDataForFailedRevalidation() {} |
void setEncodedSize(size_t); |
+ void setEncodedSizeMemoryUsage(size_t); |
void setDecodedSize(size_t); |
void didAccessDecodedData(); |
@@ -401,6 +419,7 @@ class CORE_EXPORT Resource : public GarbageCollectedFinalized<Resource>, |
unsigned long m_identifier; |
size_t m_encodedSize; |
+ size_t m_encodedSizeMemoryUsage; |
size_t m_decodedSize; |
// Resource::calculateOverheadSize() is affected by changes in |