| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/file_system_operation_runner.h" | 5 #include "webkit/browser/fileapi/file_system_operation_runner.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "net/url_request/url_request_context.h" | 10 #include "net/url_request/url_request_context.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 253 } |
| 254 | 254 |
| 255 scoped_ptr<FileStreamWriter> writer( | 255 scoped_ptr<FileStreamWriter> writer( |
| 256 file_system_context_->CreateFileStreamWriter(url, offset)); | 256 file_system_context_->CreateFileStreamWriter(url, offset)); |
| 257 if (!writer) { | 257 if (!writer) { |
| 258 // Write is not supported. | 258 // Write is not supported. |
| 259 DidWrite(handle, callback, base::File::FILE_ERROR_SECURITY, 0, true); | 259 DidWrite(handle, callback, base::File::FILE_ERROR_SECURITY, 0, true); |
| 260 return handle.id; | 260 return handle.id; |
| 261 } | 261 } |
| 262 | 262 |
| 263 FileWriterDelegate::FlushPolicy flush_policy = |
| 264 file_system_context_->ShouldFlushOnWriteCompletion(url.type()) |
| 265 ? FileWriterDelegate::FLUSH_ON_COMPLETION |
| 266 : FileWriterDelegate::NO_FLUSH_ON_COMPLETION; |
| 263 scoped_ptr<FileWriterDelegate> writer_delegate( | 267 scoped_ptr<FileWriterDelegate> writer_delegate( |
| 264 new FileWriterDelegate(writer.Pass())); | 268 new FileWriterDelegate(writer.Pass(), flush_policy)); |
| 265 | 269 |
| 266 scoped_ptr<net::URLRequest> blob_request( | 270 scoped_ptr<net::URLRequest> blob_request( |
| 267 webkit_blob::BlobProtocolHandler::CreateBlobRequest( | 271 webkit_blob::BlobProtocolHandler::CreateBlobRequest( |
| 268 blob.Pass(), | 272 blob.Pass(), |
| 269 url_request_context, | 273 url_request_context, |
| 270 writer_delegate.get())); | 274 writer_delegate.get())); |
| 271 | 275 |
| 272 PrepareForWrite(handle.id, url); | 276 PrepareForWrite(handle.id, url); |
| 273 operation->Write( | 277 operation->Write( |
| 274 url, writer_delegate.Pass(), blob_request.Pass(), | 278 url, writer_delegate.Pass(), blob_request.Pass(), |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 stray_cancel_callbacks_.find(id); | 682 stray_cancel_callbacks_.find(id); |
| 679 if (found_cancel != stray_cancel_callbacks_.end()) { | 683 if (found_cancel != stray_cancel_callbacks_.end()) { |
| 680 // This cancel has been requested after the operation has finished, | 684 // This cancel has been requested after the operation has finished, |
| 681 // so report that we failed to stop it. | 685 // so report that we failed to stop it. |
| 682 found_cancel->second.Run(base::File::FILE_ERROR_INVALID_OPERATION); | 686 found_cancel->second.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
| 683 stray_cancel_callbacks_.erase(found_cancel); | 687 stray_cancel_callbacks_.erase(found_cancel); |
| 684 } | 688 } |
| 685 } | 689 } |
| 686 | 690 |
| 687 } // namespace fileapi | 691 } // namespace fileapi |
| OLD | NEW |