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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(new LocalFileStreamWriter( | 140 local_file_writer_.reset(new LocalFileStreamWriter( |
141 file_system_context_->default_file_task_runner(), platform_path, | 141 file_system_context_->default_file_task_runner(), platform_path, |
142 initial_offset_)); | 142 initial_offset_, true)); |
143 | 143 |
144 quota::QuotaManagerProxy* quota_manager_proxy = | 144 quota::QuotaManagerProxy* quota_manager_proxy = |
145 file_system_context_->quota_manager_proxy(); | 145 file_system_context_->quota_manager_proxy(); |
146 if (!quota_manager_proxy) { | 146 if (!quota_manager_proxy) { |
147 // If we don't have the quota manager or the requested filesystem type | 147 // 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. | 148 // does not support quota, we should be able to let it go. |
149 allowed_bytes_to_write_ = default_quota_; | 149 allowed_bytes_to_write_ = default_quota_; |
150 callback.Run(net::OK); | 150 callback.Run(net::OK); |
151 return; | 151 return; |
152 } | 152 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 DCHECK(cancel_callback_.is_null()); | 236 DCHECK(cancel_callback_.is_null()); |
237 | 237 |
238 // Write() is not called yet, so there's nothing to flush. | 238 // Write() is not called yet, so there's nothing to flush. |
239 if (!local_file_writer_) | 239 if (!local_file_writer_) |
240 return net::OK; | 240 return net::OK; |
241 | 241 |
242 return local_file_writer_->Flush(callback); | 242 return local_file_writer_->Flush(callback); |
243 } | 243 } |
244 | 244 |
245 } // namespace fileapi | 245 } // namespace fileapi |
OLD | NEW |