Chromium Code Reviews| 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 a338bfac11e916a0606fab3c231438dd23edd395..7aae33e8c09fb14c5ef5661ebc03d7bdf0a12c90 100644 |
| --- a/third_party/WebKit/Source/core/fetch/Resource.h |
| +++ b/third_party/WebKit/Source/core/fetch/Resource.h |
| @@ -169,7 +169,21 @@ 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 |encodedSizeMemoryUsage()| can return different values, |
| + // e.g., when ImageResource purges encoded image data after finishing loading. |
| + size_t encodedSizeMemoryUsage() const { return m_encodedSizeMemoryUsage; } |
|
yhirano
2016/10/17 05:25:16
Can you add ForTest[ing] suffix?
hiroshige
2016/10/19 04:04:01
I'm neutral about this; encodedSizeMemoryUsage() i
yhirano
2016/10/19 05:36:11
The field is not for testing but this getter is fo
hajimehoshi
2016/10/21 06:41:23
Done.
|
| + |
| size_t decodedSize() const { return m_decodedSize; } |
| size_t overheadSize() const { return m_overheadSize; } |
| @@ -319,6 +333,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 +416,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 |