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 #include "webkit/browser/fileapi/sandbox_file_stream_writer.h" | 5 #include "webkit/browser/fileapi/sandbox_file_stream_writer.h" |
6 | 6 |
7 #include "base/files/file_util_proxy.h" | 7 #include "base/files/file_util_proxy.h" |
8 #include "base/platform_file.h" | 8 #include "base/platform_file.h" |
9 #include "base/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
12 #include "webkit/browser/blob/file_stream_reader.h" | 12 #include "webkit/browser/blob/file_stream_reader.h" |
13 #include "webkit/browser/fileapi/file_observers.h" | 13 #include "webkit/browser/fileapi/file_observers.h" |
14 #include "webkit/browser/fileapi/file_stream_writer.h" | 14 #include "webkit/browser/fileapi/file_stream_writer.h" |
15 #include "webkit/browser/fileapi/file_system_context.h" | 15 #include "webkit/browser/fileapi/file_system_context.h" |
16 #include "webkit/browser/fileapi/file_system_operation_runner.h" | 16 #include "webkit/browser/fileapi/file_system_operation_runner.h" |
17 #include "webkit/browser/quota/quota_manager.h" | 17 #include "webkit/browser/quota/quota_manager_proxy.h" |
18 #include "webkit/common/fileapi/file_system_util.h" | 18 #include "webkit/common/fileapi/file_system_util.h" |
19 | 19 |
20 namespace fileapi { | 20 namespace fileapi { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 // Adjust the |quota| value in overwriting case (i.e. |file_size| > 0 and | 24 // Adjust the |quota| value in overwriting case (i.e. |file_size| > 0 and |
25 // |file_offset| < |file_size|) to make the remaining quota calculation easier. | 25 // |file_offset| < |file_size|) to make the remaining quota calculation easier. |
26 // Specifically this widens the quota for overlapping range (so that we can | 26 // Specifically this widens the quota for overlapping range (so that we can |
27 // simply compare written bytes against the adjusted quota). | 27 // simply compare written bytes against the adjusted quota). |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 DCHECK(cancel_callback_.is_null()); | 236 DCHECK(cancel_callback_.is_null()); |
237 | 237 |
238 // Write() is not called yet, so there's nothing to flush. | 238 // Write() is not called yet, so there's nothing to flush. |
239 if (!local_file_writer_) | 239 if (!local_file_writer_) |
240 return net::OK; | 240 return net::OK; |
241 | 241 |
242 return local_file_writer_->Flush(callback); | 242 return local_file_writer_->Flush(callback); |
243 } | 243 } |
244 | 244 |
245 } // namespace fileapi | 245 } // namespace fileapi |
OLD | NEW |