[email protected] | 43fe9f5 | 2012-01-03 18:52:10 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | 98d6d456 | 2014-06-25 20:57:55 | [diff] [blame^] | 5 | #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_H_ |
| 6 | #define CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_H_ |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 7 | |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 8 | #include "base/compiler_specific.h" |
[email protected] | 3b63f8f4 | 2011-03-28 01:54:15 | [diff] [blame] | 9 | #include "base/memory/ref_counted.h" |
| 10 | #include "base/memory/scoped_ptr.h" |
[email protected] | e29f933 | 2011-10-28 22:44:57 | [diff] [blame] | 11 | #include "base/memory/weak_ptr.h" |
[email protected] | 98d6d456 | 2014-06-25 20:57:55 | [diff] [blame^] | 12 | #include "content/common/appcache_interfaces.h" |
| 13 | #include "content/common/content_export.h" |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 14 | #include "net/base/completion_callback.h" |
| 15 | #include "net/http/http_response_info.h" |
[email protected] | ad67777 | 2013-06-29 14:18:38 | [diff] [blame] | 16 | #include "url/gurl.h" |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 17 | |
| 18 | namespace net { |
| 19 | class IOBuffer; |
| 20 | } |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 21 | |
[email protected] | 71fe3d1 | 2014-04-22 00:32:38 | [diff] [blame] | 22 | namespace content { |
| 23 | class MockAppCacheStorage; |
| 24 | } |
| 25 | |
[email protected] | 98d6d456 | 2014-06-25 20:57:55 | [diff] [blame^] | 26 | namespace content { |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 27 | |
[email protected] | 9f67dd0 | 2013-10-22 23:08:20 | [diff] [blame] | 28 | class AppCacheStorage; |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 29 | |
[email protected] | fd2885a | 2010-03-17 22:02:28 | [diff] [blame] | 30 | static const int kUnkownResponseDataSize = -1; |
| 31 | |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 32 | // Response info for a particular response id. Instances are tracked in |
| 33 | // the working set. |
[email protected] | 98d6d456 | 2014-06-25 20:57:55 | [diff] [blame^] | 34 | class CONTENT_EXPORT AppCacheResponseInfo |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 35 | : public base::RefCounted<AppCacheResponseInfo> { |
[email protected] | d144b05 | 2009-10-13 01:45:09 | [diff] [blame] | 36 | public: |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 37 | // AppCacheResponseInfo takes ownership of the http_info. |
[email protected] | 9f67dd0 | 2013-10-22 23:08:20 | [diff] [blame] | 38 | AppCacheResponseInfo(AppCacheStorage* storage, const GURL& manifest_url, |
[email protected] | fd2885a | 2010-03-17 22:02:28 | [diff] [blame] | 39 | int64 response_id, net::HttpResponseInfo* http_info, |
| 40 | int64 response_data_size); |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 41 | |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 42 | const GURL& manifest_url() const { return manifest_url_; } |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 43 | int64 response_id() const { return response_id_; } |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 44 | const net::HttpResponseInfo* http_response_info() const { |
| 45 | return http_response_info_.get(); |
| 46 | } |
[email protected] | fd2885a | 2010-03-17 22:02:28 | [diff] [blame] | 47 | int64 response_data_size() const { return response_data_size_; } |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 48 | |
| 49 | private: |
[email protected] | 122331d5 | 2009-11-05 23:40:45 | [diff] [blame] | 50 | friend class base::RefCounted<AppCacheResponseInfo>; |
[email protected] | 20f0487a | 2010-09-30 20:06:30 | [diff] [blame] | 51 | virtual ~AppCacheResponseInfo(); |
[email protected] | 122331d5 | 2009-11-05 23:40:45 | [diff] [blame] | 52 | |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 53 | const GURL manifest_url_; |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 54 | const int64 response_id_; |
| 55 | const scoped_ptr<net::HttpResponseInfo> http_response_info_; |
[email protected] | fd2885a | 2010-03-17 22:02:28 | [diff] [blame] | 56 | const int64 response_data_size_; |
[email protected] | 9f67dd0 | 2013-10-22 23:08:20 | [diff] [blame] | 57 | AppCacheStorage* storage_; |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 58 | }; |
| 59 | |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 60 | // A refcounted wrapper for HttpResponseInfo so we can apply the |
| 61 | // refcounting semantics used with IOBuffer with these structures too. |
[email protected] | 98d6d456 | 2014-06-25 20:57:55 | [diff] [blame^] | 62 | struct CONTENT_EXPORT HttpResponseInfoIOBuffer |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 63 | : public base::RefCountedThreadSafe<HttpResponseInfoIOBuffer> { |
| 64 | scoped_ptr<net::HttpResponseInfo> http_info; |
[email protected] | fd2885a | 2010-03-17 22:02:28 | [diff] [blame] | 65 | int response_data_size; |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 66 | |
[email protected] | 20f0487a | 2010-09-30 20:06:30 | [diff] [blame] | 67 | HttpResponseInfoIOBuffer(); |
| 68 | explicit HttpResponseInfoIOBuffer(net::HttpResponseInfo* info); |
[email protected] | 122331d5 | 2009-11-05 23:40:45 | [diff] [blame] | 69 | |
[email protected] | 8022ed5 | 2014-05-06 03:13:40 | [diff] [blame] | 70 | protected: |
[email protected] | 122331d5 | 2009-11-05 23:40:45 | [diff] [blame] | 71 | friend class base::RefCountedThreadSafe<HttpResponseInfoIOBuffer>; |
[email protected] | 20f0487a | 2010-09-30 20:06:30 | [diff] [blame] | 72 | virtual ~HttpResponseInfoIOBuffer(); |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 73 | }; |
| 74 | |
[email protected] | 5030416 | 2011-12-21 17:51:30 | [diff] [blame] | 75 | // Low level storage API used by the response reader and writer. |
[email protected] | 98d6d456 | 2014-06-25 20:57:55 | [diff] [blame^] | 76 | class CONTENT_EXPORT AppCacheDiskCacheInterface { |
[email protected] | f5a73e07 | 2011-09-19 19:34:17 | [diff] [blame] | 77 | public: |
| 78 | class Entry { |
| 79 | public: |
| 80 | virtual int Read(int index, int64 offset, net::IOBuffer* buf, int buf_len, |
[email protected] | 2a65aceb8 | 2011-12-19 20:59:27 | [diff] [blame] | 81 | const net::CompletionCallback& callback) = 0; |
[email protected] | f5a73e07 | 2011-09-19 19:34:17 | [diff] [blame] | 82 | virtual int Write(int index, int64 offset, net::IOBuffer* buf, int buf_len, |
[email protected] | 2a65aceb8 | 2011-12-19 20:59:27 | [diff] [blame] | 83 | const net::CompletionCallback& callback) = 0; |
[email protected] | f5a73e07 | 2011-09-19 19:34:17 | [diff] [blame] | 84 | virtual int64 GetSize(int index) = 0; |
| 85 | virtual void Close() = 0; |
| 86 | protected: |
| 87 | virtual ~Entry() {} |
| 88 | }; |
| 89 | |
| 90 | virtual int CreateEntry(int64 key, Entry** entry, |
[email protected] | 5030416 | 2011-12-21 17:51:30 | [diff] [blame] | 91 | const net::CompletionCallback& callback) = 0; |
[email protected] | f5a73e07 | 2011-09-19 19:34:17 | [diff] [blame] | 92 | virtual int OpenEntry(int64 key, Entry** entry, |
[email protected] | 5030416 | 2011-12-21 17:51:30 | [diff] [blame] | 93 | const net::CompletionCallback& callback) = 0; |
| 94 | virtual int DoomEntry(int64 key, const net::CompletionCallback& callback) = 0; |
[email protected] | f5a73e07 | 2011-09-19 19:34:17 | [diff] [blame] | 95 | |
| 96 | protected: |
| 97 | friend class base::RefCounted<AppCacheDiskCacheInterface>; |
| 98 | virtual ~AppCacheDiskCacheInterface() {} |
| 99 | }; |
| 100 | |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 101 | // Common base class for response reader and writer. |
[email protected] | 98d6d456 | 2014-06-25 20:57:55 | [diff] [blame^] | 102 | class CONTENT_EXPORT AppCacheResponseIO { |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 103 | public: |
| 104 | virtual ~AppCacheResponseIO(); |
| 105 | int64 response_id() const { return response_id_; } |
| 106 | |
| 107 | protected: |
[email protected] | f5a73e07 | 2011-09-19 19:34:17 | [diff] [blame] | 108 | AppCacheResponseIO(int64 response_id, |
[email protected] | 4252f60 | 2011-10-21 19:18:36 | [diff] [blame] | 109 | int64 group_id, |
[email protected] | f5a73e07 | 2011-09-19 19:34:17 | [diff] [blame] | 110 | AppCacheDiskCacheInterface* disk_cache); |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 111 | |
| 112 | virtual void OnIOComplete(int result) = 0; |
| 113 | |
[email protected] | 5030416 | 2011-12-21 17:51:30 | [diff] [blame] | 114 | bool IsIOPending() { return !callback_.is_null(); } |
[email protected] | 72a3ce5 | 2011-12-22 05:10:24 | [diff] [blame] | 115 | void ScheduleIOCompletionCallback(int result); |
| 116 | void InvokeUserCompletionCallback(int result); |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 117 | void ReadRaw(int index, int offset, net::IOBuffer* buf, int buf_len); |
| 118 | void WriteRaw(int index, int offset, net::IOBuffer* buf, int buf_len); |
| 119 | |
| 120 | const int64 response_id_; |
[email protected] | 4252f60 | 2011-10-21 19:18:36 | [diff] [blame] | 121 | const int64 group_id_; |
[email protected] | f5a73e07 | 2011-09-19 19:34:17 | [diff] [blame] | 122 | AppCacheDiskCacheInterface* disk_cache_; |
| 123 | AppCacheDiskCacheInterface::Entry* entry_; |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 124 | scoped_refptr<HttpResponseInfoIOBuffer> info_buffer_; |
| 125 | scoped_refptr<net::IOBuffer> buffer_; |
[email protected] | fd2885a | 2010-03-17 22:02:28 | [diff] [blame] | 126 | int buffer_len_; |
[email protected] | 5030416 | 2011-12-21 17:51:30 | [diff] [blame] | 127 | net::CompletionCallback callback_; |
[email protected] | e29f933 | 2011-10-28 22:44:57 | [diff] [blame] | 128 | base::WeakPtrFactory<AppCacheResponseIO> weak_factory_; |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 129 | |
| 130 | private: |
| 131 | void OnRawIOComplete(int result); |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 132 | }; |
| 133 | |
| 134 | // Reads existing response data from storage. If the object is deleted |
| 135 | // and there is a read in progress, the implementation will return |
| 136 | // immediately but will take care of any side effect of cancelling the |
| 137 | // operation. In other words, instances are safe to delete at will. |
[email protected] | 98d6d456 | 2014-06-25 20:57:55 | [diff] [blame^] | 138 | class CONTENT_EXPORT AppCacheResponseReader |
[email protected] | e5bf2fd | 2013-06-13 02:59:18 | [diff] [blame] | 139 | : public AppCacheResponseIO { |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 140 | public: |
[email protected] | fd2885a | 2010-03-17 22:02:28 | [diff] [blame] | 141 | virtual ~AppCacheResponseReader(); |
| 142 | |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 143 | // Reads http info from storage. Always returns the result of the read |
| 144 | // asynchronously through the 'callback'. Returns the number of bytes read |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 145 | // or a net:: error code. Guaranteed to not perform partial reads of |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 146 | // the info data. The reader acquires a reference to the 'info_buf' until |
| 147 | // completion at which time the callback is invoked with either a negative |
| 148 | // error code or the number of bytes read. The 'info_buf' argument should |
| 149 | // contain a NULL http_info when ReadInfo is called. The 'callback' is a |
| 150 | // required parameter. |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 151 | // Should only be called where there is no Read operation in progress. |
[email protected] | 20d06f6 | 2011-07-22 23:57:35 | [diff] [blame] | 152 | // (virtual for testing) |
| 153 | virtual void ReadInfo(HttpResponseInfoIOBuffer* info_buf, |
[email protected] | 5030416 | 2011-12-21 17:51:30 | [diff] [blame] | 154 | const net::CompletionCallback& callback); |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 155 | |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 156 | // Reads data from storage. Always returns the result of the read |
| 157 | // asynchronously through the 'callback'. Returns the number of bytes read |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 158 | // or a net:: error code. EOF is indicated with a return value of zero. |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 159 | // The reader acquires a reference to the provided 'buf' until completion |
| 160 | // at which time the callback is invoked with either a negative error code |
| 161 | // or the number of bytes read. The 'callback' is a required parameter. |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 162 | // Should only be called where there is no Read operation in progress. |
[email protected] | 20d06f6 | 2011-07-22 23:57:35 | [diff] [blame] | 163 | // (virtual for testing) |
| 164 | virtual void ReadData(net::IOBuffer* buf, int buf_len, |
[email protected] | 5030416 | 2011-12-21 17:51:30 | [diff] [blame] | 165 | const net::CompletionCallback& callback); |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 166 | |
| 167 | // Returns true if there is a read operation, for data or info, pending. |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 168 | bool IsReadPending() { return IsIOPending(); } |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 169 | |
| 170 | // Used to support range requests. If not called, the reader will |
| 171 | // read the entire response body. If called, this must be called prior |
| 172 | // to the first call to the ReadData method. |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 173 | void SetReadRange(int offset, int length); |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 174 | |
[email protected] | 20d06f6 | 2011-07-22 23:57:35 | [diff] [blame] | 175 | protected: |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 176 | friend class AppCacheStorageImpl; |
[email protected] | 71fe3d1 | 2014-04-22 00:32:38 | [diff] [blame] | 177 | friend class content::MockAppCacheStorage; |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 178 | |
[email protected] | 8022ed5 | 2014-05-06 03:13:40 | [diff] [blame] | 179 | // Should only be constructed by the storage class and derivatives. |
[email protected] | f5a73e07 | 2011-09-19 19:34:17 | [diff] [blame] | 180 | AppCacheResponseReader(int64 response_id, |
[email protected] | 4252f60 | 2011-10-21 19:18:36 | [diff] [blame] | 181 | int64 group_id, |
[email protected] | f5a73e07 | 2011-09-19 19:34:17 | [diff] [blame] | 182 | AppCacheDiskCacheInterface* disk_cache); |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 183 | |
[email protected] | 0da6b445 | 2011-11-16 21:36:16 | [diff] [blame] | 184 | virtual void OnIOComplete(int result) OVERRIDE; |
[email protected] | fd2885a | 2010-03-17 22:02:28 | [diff] [blame] | 185 | void ContinueReadInfo(); |
| 186 | void ContinueReadData(); |
| 187 | void OpenEntryIfNeededAndContinue(); |
[email protected] | 43fe9f5 | 2012-01-03 18:52:10 | [diff] [blame] | 188 | void OnOpenEntryComplete(AppCacheDiskCacheInterface::Entry** entry, int rv); |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 189 | |
| 190 | int range_offset_; |
| 191 | int range_length_; |
| 192 | int read_position_; |
[email protected] | 43fe9f5 | 2012-01-03 18:52:10 | [diff] [blame] | 193 | net::CompletionCallback open_callback_; |
| 194 | base::WeakPtrFactory<AppCacheResponseReader> weak_factory_; |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 195 | }; |
| 196 | |
| 197 | // Writes new response data to storage. If the object is deleted |
| 198 | // and there is a write in progress, the implementation will return |
| 199 | // immediately but will take care of any side effect of cancelling the |
| 200 | // operation. In other words, instances are safe to delete at will. |
[email protected] | 98d6d456 | 2014-06-25 20:57:55 | [diff] [blame^] | 201 | class CONTENT_EXPORT AppCacheResponseWriter |
[email protected] | e5bf2fd | 2013-06-13 02:59:18 | [diff] [blame] | 202 | : public AppCacheResponseIO { |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 203 | public: |
[email protected] | fd2885a | 2010-03-17 22:02:28 | [diff] [blame] | 204 | virtual ~AppCacheResponseWriter(); |
| 205 | |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 206 | // Writes the http info to storage. Always returns the result of the write |
| 207 | // asynchronously through the 'callback'. Returns the number of bytes written |
| 208 | // or a net:: error code. The writer acquires a reference to the 'info_buf' |
| 209 | // until completion at which time the callback is invoked with either a |
| 210 | // negative error code or the number of bytes written. The 'callback' is a |
| 211 | // required parameter. The contents of 'info_buf' are not modified. |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 212 | // Should only be called where there is no Write operation in progress. |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 213 | void WriteInfo(HttpResponseInfoIOBuffer* info_buf, |
[email protected] | 5030416 | 2011-12-21 17:51:30 | [diff] [blame] | 214 | const net::CompletionCallback& callback); |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 215 | |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 216 | // Writes data to storage. Always returns the result of the write |
| 217 | // asynchronously through the 'callback'. Returns the number of bytes written |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 218 | // or a net:: error code. Guaranteed to not perform partial writes. |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 219 | // The writer acquires a reference to the provided 'buf' until completion at |
| 220 | // which time the callback is invoked with either a negative error code or |
| 221 | // the number of bytes written. The 'callback' is a required parameter. |
| 222 | // The contents of 'buf' are not modified. |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 223 | // Should only be called where there is no Write operation in progress. |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 224 | void WriteData(net::IOBuffer* buf, int buf_len, |
[email protected] | 5030416 | 2011-12-21 17:51:30 | [diff] [blame] | 225 | const net::CompletionCallback& callback); |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 226 | |
| 227 | // Returns true if there is a write pending. |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 228 | bool IsWritePending() { return IsIOPending(); } |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 229 | |
[email protected] | 0dfeec3 | 2010-01-06 22:25:33 | [diff] [blame] | 230 | // Returns the amount written, info and data. |
| 231 | int64 amount_written() { return info_size_ + write_position_; } |
| 232 | |
[email protected] | 8022ed5 | 2014-05-06 03:13:40 | [diff] [blame] | 233 | protected: |
| 234 | // Should only be constructed by the storage class and derivatives. |
| 235 | AppCacheResponseWriter(int64 response_id, |
| 236 | int64 group_id, |
| 237 | AppCacheDiskCacheInterface* disk_cache); |
| 238 | |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 239 | private: |
| 240 | friend class AppCacheStorageImpl; |
[email protected] | 71fe3d1 | 2014-04-22 00:32:38 | [diff] [blame] | 241 | friend class content::MockAppCacheStorage; |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 242 | |
[email protected] | fd2885a | 2010-03-17 22:02:28 | [diff] [blame] | 243 | enum CreationPhase { |
| 244 | NO_ATTEMPT, |
| 245 | INITIAL_ATTEMPT, |
| 246 | DOOM_EXISTING, |
| 247 | SECOND_ATTEMPT |
| 248 | }; |
| 249 | |
[email protected] | 0da6b445 | 2011-11-16 21:36:16 | [diff] [blame] | 250 | virtual void OnIOComplete(int result) OVERRIDE; |
[email protected] | fd2885a | 2010-03-17 22:02:28 | [diff] [blame] | 251 | void ContinueWriteInfo(); |
| 252 | void ContinueWriteData(); |
| 253 | void CreateEntryIfNeededAndContinue(); |
[email protected] | 43fe9f5 | 2012-01-03 18:52:10 | [diff] [blame] | 254 | void OnCreateEntryComplete(AppCacheDiskCacheInterface::Entry** entry, int rv); |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 255 | |
[email protected] | 0dfeec3 | 2010-01-06 22:25:33 | [diff] [blame] | 256 | int info_size_; |
[email protected] | 073aabe | 2009-10-21 18:09:33 | [diff] [blame] | 257 | int write_position_; |
| 258 | int write_amount_; |
[email protected] | fd2885a | 2010-03-17 22:02:28 | [diff] [blame] | 259 | CreationPhase creation_phase_; |
[email protected] | 43fe9f5 | 2012-01-03 18:52:10 | [diff] [blame] | 260 | net::CompletionCallback create_callback_; |
| 261 | base::WeakPtrFactory<AppCacheResponseWriter> weak_factory_; |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 262 | }; |
| 263 | |
[email protected] | 98d6d456 | 2014-06-25 20:57:55 | [diff] [blame^] | 264 | } // namespace content |
[email protected] | e7dff7ba | 2009-10-09 03:25:51 | [diff] [blame] | 265 | |
[email protected] | 98d6d456 | 2014-06-25 20:57:55 | [diff] [blame^] | 266 | #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_H_ |