Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: webkit/browser/fileapi/sandbox_file_stream_writer.cc

Issue 20989003: Deprecate FileSystemTaskRunners (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
12 #include "webkit/browser/blob/local_file_stream_reader.h" 12 #include "webkit/browser/blob/local_file_stream_reader.h"
13 #include "webkit/browser/fileapi/file_observers.h" 13 #include "webkit/browser/fileapi/file_observers.h"
14 #include "webkit/browser/fileapi/file_system_context.h" 14 #include "webkit/browser/fileapi/file_system_context.h"
15 #include "webkit/browser/fileapi/file_system_operation_runner.h" 15 #include "webkit/browser/fileapi/file_system_operation_runner.h"
16 #include "webkit/browser/fileapi/file_system_task_runners.h"
17 #include "webkit/browser/fileapi/local_file_stream_writer.h" 16 #include "webkit/browser/fileapi/local_file_stream_writer.h"
18 #include "webkit/browser/quota/quota_manager.h" 17 #include "webkit/browser/quota/quota_manager.h"
19 #include "webkit/common/fileapi/file_system_util.h" 18 #include "webkit/common/fileapi/file_system_util.h"
20 19
21 namespace fileapi { 20 namespace fileapi {
22 21
23 namespace { 22 namespace {
24 23
25 // Adjust the |quota| value in overwriting case (i.e. |file_size| > 0 and 24 // Adjust the |quota| value in overwriting case (i.e. |file_size| > 0 and
26 // |file_offset| < |file_size|) to make the remaining quota calculation easier. 25 // |file_offset| < |file_size|) to make the remaining quota calculation easier.
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 131 }
133 file_size_ = file_info.size; 132 file_size_ = file_info.size;
134 if (initial_offset_ > file_size_) { 133 if (initial_offset_ > file_size_) {
135 LOG(ERROR) << initial_offset_ << ", " << file_size_; 134 LOG(ERROR) << initial_offset_ << ", " << file_size_;
136 // 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.
137 NOTREACHED(); 136 NOTREACHED();
138 initial_offset_ = file_size_; 137 initial_offset_ = file_size_;
139 } 138 }
140 DCHECK(!local_file_writer_.get()); 139 DCHECK(!local_file_writer_.get());
141 local_file_writer_.reset(new LocalFileStreamWriter( 140 local_file_writer_.reset(new LocalFileStreamWriter(
142 file_system_context_->task_runners()->file_task_runner(), platform_path, 141 file_system_context_->default_file_task_runner(), platform_path,
143 initial_offset_)); 142 initial_offset_));
144 143
145 quota::QuotaManagerProxy* quota_manager_proxy = 144 quota::QuotaManagerProxy* quota_manager_proxy =
146 file_system_context_->quota_manager_proxy(); 145 file_system_context_->quota_manager_proxy();
147 if (!quota_manager_proxy) { 146 if (!quota_manager_proxy) {
148 // 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
149 // 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.
150 allowed_bytes_to_write_ = default_quota_; 149 allowed_bytes_to_write_ = default_quota_;
151 callback.Run(net::OK); 150 callback.Run(net::OK);
152 return; 151 return;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 DCHECK(cancel_callback_.is_null()); 236 DCHECK(cancel_callback_.is_null());
238 237
239 // Write() is not called yet, so there's nothing to flush. 238 // Write() is not called yet, so there's nothing to flush.
240 if (!local_file_writer_) 239 if (!local_file_writer_)
241 return net::OK; 240 return net::OK;
242 241
243 return local_file_writer_->Flush(callback); 242 return local_file_writer_->Flush(callback);
244 } 243 }
245 244
246 } // namespace fileapi 245 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/obfuscated_file_util_unittest.cc ('k') | webkit/browser/fileapi/sandbox_file_system_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698