Chromium Code Reviews| Index: content/browser/appcache/appcache_response.h |
| diff --git a/content/browser/appcache/appcache_response.h b/content/browser/appcache/appcache_response.h |
| index 4b7a32c6767f7fffc35baeb2bb31eded6e314538..599140f1c1464efffc05b4def2518e4d19e1fcbb 100644 |
| --- a/content/browser/appcache/appcache_response.h |
| +++ b/content/browser/appcache/appcache_response.h |
| @@ -186,6 +186,7 @@ class CONTENT_EXPORT AppCacheResponseReader |
| int range_offset_; |
| int range_length_; |
| int read_position_; |
| + int reading_metadata_size_; |
| net::CompletionCallback open_callback_; |
| base::WeakPtrFactory<AppCacheResponseReader> weak_factory_; |
| }; |
| @@ -257,6 +258,49 @@ class CONTENT_EXPORT AppCacheResponseWriter |
| base::WeakPtrFactory<AppCacheResponseWriter> weak_factory_; |
| }; |
| +// Writes metadata of the existing response to storage. If the object is deleted |
| +// and there is a write in progress, the implementation will return |
| +// immediately but will take care of any side effect of cancelling the |
| +// operation. In other words, instances are safe to delete at will. |
| +class CONTENT_EXPORT AppCacheResponseMetadataWriter |
| + : public AppCacheResponseIO { |
| + public: |
| + ~AppCacheResponseMetadataWriter() override; |
| + |
| + // Writes metadata to storage. Always returns the result of the write |
| + // asynchronously through the 'callback'. Returns the number of bytes written |
| + // or a net:: error code. Guaranteed to not perform partial writes. |
| + // The writer acquires a reference to the provided 'buf' until completion at |
| + // which time the callback is invoked with either a negative error code or |
| + // the number of bytes written. The 'callback' is a required parameter. |
| + // The contents of 'buf' are not modified. |
| + // Can't be called multiple times. |
| + void WriteMetadata(net::IOBuffer* buf, |
| + int buf_len, |
| + const net::CompletionCallback& callback); |
| + |
| + // Returns true if there is a write pending. |
| + bool IsWritePending() { return IsIOPending(); } |
| + |
| + protected: |
| + friend class AppCacheStorageImpl; |
| + friend class content::MockAppCacheStorage; |
| + // Should only be constructed by the storage class and derivatives. |
| + AppCacheResponseMetadataWriter(int64 response_id, |
| + int64 group_id, |
| + AppCacheDiskCacheInterface* disk_cache); |
| + |
| + private: |
| + void OnIOComplete(int result) override; |
| + void OpenEntry(); |
| + void OnOpenEntryComplete(AppCacheDiskCacheInterface::Entry** entry, int rv); |
| + |
| + bool started_; |
|
michaeln
2015/02/18 02:18:59
is this used?
horo
2015/02/18 03:33:44
deleted
|
| + int write_amount_; |
| + net::CompletionCallback open_callback_; |
| + base::WeakPtrFactory<AppCacheResponseMetadataWriter> weak_factory_; |
| +}; |
| + |
| } // namespace content |
| #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_H_ |