| 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/local_file_stream_writer.h" | 5 #include "webkit/browser/fileapi/local_file_stream_writer.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "net/base/file_stream.h" | 9 #include "net/base/file_stream.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 const base::Closure& main_operation) { | 146 const base::Closure& main_operation) { |
| 147 DCHECK(has_pending_operation_); | 147 DCHECK(has_pending_operation_); |
| 148 DCHECK(stream_impl_.get()); | 148 DCHECK(stream_impl_.get()); |
| 149 | 149 |
| 150 if (initial_offset_ == 0) { | 150 if (initial_offset_ == 0) { |
| 151 // No need to seek. | 151 // No need to seek. |
| 152 main_operation.Run(); | 152 main_operation.Run(); |
| 153 return; | 153 return; |
| 154 } | 154 } |
| 155 | 155 |
| 156 int result = stream_impl_->Seek(net::FROM_BEGIN, initial_offset_, | 156 int result = stream_impl_->Seek(base::File::FROM_BEGIN, initial_offset_, |
| 157 base::Bind(&LocalFileStreamWriter::DidSeek, | 157 base::Bind(&LocalFileStreamWriter::DidSeek, |
| 158 weak_factory_.GetWeakPtr(), | 158 weak_factory_.GetWeakPtr(), |
| 159 error_callback, | 159 error_callback, |
| 160 main_operation)); | 160 main_operation)); |
| 161 if (result != net::ERR_IO_PENDING) { | 161 if (result != net::ERR_IO_PENDING) { |
| 162 has_pending_operation_ = false; | 162 has_pending_operation_ = false; |
| 163 error_callback.Run(result); | 163 error_callback.Run(result); |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 return false; | 248 return false; |
| 249 | 249 |
| 250 net::CompletionCallback pending_cancel = cancel_callback_; | 250 net::CompletionCallback pending_cancel = cancel_callback_; |
| 251 has_pending_operation_ = false; | 251 has_pending_operation_ = false; |
| 252 cancel_callback_.Reset(); | 252 cancel_callback_.Reset(); |
| 253 pending_cancel.Run(net::OK); | 253 pending_cancel.Run(net::OK); |
| 254 return true; | 254 return true; |
| 255 } | 255 } |
| 256 | 256 |
| 257 } // namespace fileapi | 257 } // namespace fileapi |
| OLD | NEW |