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/fileapi/sandbox_file_stream_writer.h" | 5 #include "webkit/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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 const UpdateObserverList& observers) | 46 const UpdateObserverList& observers) |
47 : file_system_context_(file_system_context), | 47 : file_system_context_(file_system_context), |
48 url_(url), | 48 url_(url), |
49 initial_offset_(initial_offset), | 49 initial_offset_(initial_offset), |
50 observers_(observers), | 50 observers_(observers), |
51 file_size_(0), | 51 file_size_(0), |
52 total_bytes_written_(0), | 52 total_bytes_written_(0), |
53 allowed_bytes_to_write_(0), | 53 allowed_bytes_to_write_(0), |
54 has_pending_operation_(false), | 54 has_pending_operation_(false), |
55 default_quota_(kint64max), | 55 default_quota_(kint64max), |
56 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 56 weak_factory_(this) { |
57 DCHECK(url_.is_valid()); | 57 DCHECK(url_.is_valid()); |
58 } | 58 } |
59 | 59 |
60 SandboxFileStreamWriter::~SandboxFileStreamWriter() {} | 60 SandboxFileStreamWriter::~SandboxFileStreamWriter() {} |
61 | 61 |
62 int SandboxFileStreamWriter::Write( | 62 int SandboxFileStreamWriter::Write( |
63 net::IOBuffer* buf, int buf_len, | 63 net::IOBuffer* buf, int buf_len, |
64 const net::CompletionCallback& callback) { | 64 const net::CompletionCallback& callback) { |
65 has_pending_operation_ = true; | 65 has_pending_operation_ = true; |
66 if (local_file_writer_.get()) | 66 if (local_file_writer_.get()) |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 return true; | 234 return true; |
235 } | 235 } |
236 | 236 |
237 int SandboxFileStreamWriter::Flush(const net::CompletionCallback& callback) { | 237 int SandboxFileStreamWriter::Flush(const net::CompletionCallback& callback) { |
238 // For now, Flush is meaningful only for local native file access. It is no-op | 238 // For now, Flush is meaningful only for local native file access. It is no-op |
239 // for sandboxed filesystem files (see the discussion in crbug.com/144790). | 239 // for sandboxed filesystem files (see the discussion in crbug.com/144790). |
240 return net::OK; | 240 return net::OK; |
241 } | 241 } |
242 | 242 |
243 } // namespace fileapi | 243 } // namespace fileapi |
OLD | NEW |