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