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/fileapi/file_writer_delegate.h" | 5 #include "webkit/fileapi/file_writer_delegate.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/files/file_util_proxy.h" | 9 #include "base/files/file_util_proxy.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/message_loop_proxy.h" | 11 #include "base/message_loop_proxy.h" |
12 #include "base/task/sequenced_task_runner.h" | 12 #include "base/sequenced_task_runner.h" |
13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
15 #include "webkit/fileapi/file_stream_writer.h" | 15 #include "webkit/fileapi/file_stream_writer.h" |
16 #include "webkit/fileapi/file_system_context.h" | 16 #include "webkit/fileapi/file_system_context.h" |
17 | 17 |
18 namespace fileapi { | 18 namespace fileapi { |
19 | 19 |
20 static const int kReadBufSize = 32768; | 20 static const int kReadBufSize = 32768; |
21 | 21 |
22 namespace { | 22 namespace { |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 if (error == base::PLATFORM_FILE_OK && flush_error != net::OK) { | 244 if (error == base::PLATFORM_FILE_OK && flush_error != net::OK) { |
245 // If the Flush introduced an error, overwrite the status. | 245 // If the Flush introduced an error, overwrite the status. |
246 // Otherwise, keep the original error status. | 246 // Otherwise, keep the original error status. |
247 error = NetErrorToPlatformFileError(flush_error); | 247 error = NetErrorToPlatformFileError(flush_error); |
248 progress_status = GetCompletionStatusOnError(); | 248 progress_status = GetCompletionStatusOnError(); |
249 } | 249 } |
250 write_callback_.Run(error, bytes_written, progress_status); | 250 write_callback_.Run(error, bytes_written, progress_status); |
251 } | 251 } |
252 | 252 |
253 } // namespace fileapi | 253 } // namespace fileapi |
OLD | NEW |