OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_LOADER_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_ |
6 #define CONTENT_BROWSER_LOADER_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // Called by RedirectToFileResourceHandler::Writer. | 88 // Called by RedirectToFileResourceHandler::Writer. |
89 void DidWriteToFile(int result); | 89 void DidWriteToFile(int result); |
90 | 90 |
91 // Attempts to write more data to the file, if possible. Returns false on | 91 // Attempts to write more data to the file, if possible. Returns false on |
92 // error. Returns true if there's already a write in progress, all data was | 92 // error. Returns true if there's already a write in progress, all data was |
93 // written successfully, or a new write was started that will complete | 93 // written successfully, or a new write was started that will complete |
94 // asynchronously. Resumes the request if there's more data to read and more | 94 // asynchronously. Resumes the request if there's more data to read and more |
95 // buffer space available. | 95 // buffer space available. |
96 bool WriteMore(); | 96 bool WriteMore(); |
97 | 97 |
98 bool BufIsFull() const; | |
99 | |
100 CreateTemporaryFileStreamFunction create_temporary_file_stream_; | 98 CreateTemporaryFileStreamFunction create_temporary_file_stream_; |
101 | 99 |
102 // We allocate a single, fixed-size IO buffer (buf_) used to read from the | 100 // We allocate a single, fixed-size IO buffer (buf_) used to read from the |
103 // network (buf_write_pending_ is true while the system is copying data into | 101 // network (buf_write_pending_ is true while the system is copying data into |
104 // buf_), and then write this buffer out to disk (write_callback_pending_ is | 102 // buf_), and then write this buffer out to disk (write_callback_pending_ is |
105 // true while writing to disk). Reading from the network is suspended while | 103 // true while writing to disk). Reading from the network is suspended while |
106 // the buffer is full (BufIsFull returns true). The write_cursor_ member | 104 // the buffer is full (BufIsFull returns true). The write_cursor_ member |
107 // tracks the offset into buf_ that we are writing to disk. | 105 // tracks the offset into buf_ that we are writing to disk. |
108 | 106 |
109 scoped_refptr<net::GrowableIOBuffer> buf_; | 107 scoped_refptr<net::GrowableIOBuffer> buf_; |
(...skipping 18 matching lines...) Expand all Loading... |
128 net::URLRequestStatus completed_status_; | 126 net::URLRequestStatus completed_status_; |
129 | 127 |
130 base::WeakPtrFactory<RedirectToFileResourceHandler> weak_factory_; | 128 base::WeakPtrFactory<RedirectToFileResourceHandler> weak_factory_; |
131 | 129 |
132 DISALLOW_COPY_AND_ASSIGN(RedirectToFileResourceHandler); | 130 DISALLOW_COPY_AND_ASSIGN(RedirectToFileResourceHandler); |
133 }; | 131 }; |
134 | 132 |
135 } // namespace content | 133 } // namespace content |
136 | 134 |
137 #endif // CONTENT_BROWSER_LOADER_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_ | 135 #endif // CONTENT_BROWSER_LOADER_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_ |
OLD | NEW |