| 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 "storage/browser/fileapi/sandbox_file_stream_writer.h" | 5 #include "storage/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/sequenced_task_runner.h" | 8 #include "base/sequenced_task_runner.h" |
| 9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 130 } |
| 131 file_size_ = file_info.size; | 131 file_size_ = file_info.size; |
| 132 if (initial_offset_ > file_size_) { | 132 if (initial_offset_ > file_size_) { |
| 133 LOG(ERROR) << initial_offset_ << ", " << file_size_; | 133 LOG(ERROR) << initial_offset_ << ", " << file_size_; |
| 134 // This shouldn't happen as long as we check offset in the renderer. | 134 // This shouldn't happen as long as we check offset in the renderer. |
| 135 NOTREACHED(); | 135 NOTREACHED(); |
| 136 initial_offset_ = file_size_; | 136 initial_offset_ = file_size_; |
| 137 } | 137 } |
| 138 DCHECK(!local_file_writer_.get()); | 138 DCHECK(!local_file_writer_.get()); |
| 139 local_file_writer_.reset(FileStreamWriter::CreateForLocalFile( | 139 local_file_writer_.reset(FileStreamWriter::CreateForLocalFile( |
| 140 file_system_context_->default_file_task_runner(), | 140 file_system_context_->default_file_task_runner(), platform_path, |
| 141 platform_path, | 141 initial_offset_)); |
| 142 initial_offset_, | |
| 143 FileStreamWriter::OPEN_EXISTING_FILE)); | |
| 144 | 142 |
| 145 storage::QuotaManagerProxy* quota_manager_proxy = | 143 storage::QuotaManagerProxy* quota_manager_proxy = |
| 146 file_system_context_->quota_manager_proxy(); | 144 file_system_context_->quota_manager_proxy(); |
| 147 if (!quota_manager_proxy) { | 145 if (!quota_manager_proxy) { |
| 148 // If we don't have the quota manager or the requested filesystem type | 146 // If we don't have the quota manager or the requested filesystem type |
| 149 // does not support quota, we should be able to let it go. | 147 // does not support quota, we should be able to let it go. |
| 150 allowed_bytes_to_write_ = default_quota_; | 148 allowed_bytes_to_write_ = default_quota_; |
| 151 callback.Run(net::OK); | 149 callback.Run(net::OK); |
| 152 return; | 150 return; |
| 153 } | 151 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 DCHECK(cancel_callback_.is_null()); | 236 DCHECK(cancel_callback_.is_null()); |
| 239 | 237 |
| 240 // Write() is not called yet, so there's nothing to flush. | 238 // Write() is not called yet, so there's nothing to flush. |
| 241 if (!local_file_writer_) | 239 if (!local_file_writer_) |
| 242 return net::OK; | 240 return net::OK; |
| 243 | 241 |
| 244 return local_file_writer_->Flush(callback); | 242 return local_file_writer_->Flush(callback); |
| 245 } | 243 } |
| 246 | 244 |
| 247 } // namespace storage | 245 } // namespace storage |
| OLD | NEW |