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

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

Issue 10920087: Update callers of CreateFileSystemOperation so more detailed error codes can be returned. Where app… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error Created 8 years, 3 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/fileapi/sandbox_file_stream_writer.h" 5 #include "webkit/fileapi/sandbox_file_stream_writer.h"
6 6
7 #include "base/file_util_proxy.h" 7 #include "base/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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
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())
67 return WriteInternal(buf, buf_len, callback); 67 return WriteInternal(buf, buf_len, callback);
68 68
69 base::PlatformFileError error_code;
69 FileSystemOperation* operation = 70 FileSystemOperation* operation =
70 file_system_context_->CreateFileSystemOperation(url_); 71 file_system_context_->CreateFileSystemOperation(url_, &error_code);
72 if (error_code != base::PLATFORM_FILE_OK)
73 return net::PlatformFileErrorToNetError(error_code);
74
71 DCHECK(operation); 75 DCHECK(operation);
72 net::CompletionCallback write_task = 76 net::CompletionCallback write_task =
73 base::Bind(&SandboxFileStreamWriter::DidInitializeForWrite, 77 base::Bind(&SandboxFileStreamWriter::DidInitializeForWrite,
74 weak_factory_.GetWeakPtr(), 78 weak_factory_.GetWeakPtr(),
75 make_scoped_refptr(buf), buf_len, callback); 79 make_scoped_refptr(buf), buf_len, callback);
76 operation->GetMetadata( 80 operation->GetMetadata(
77 url_, base::Bind(&SandboxFileStreamWriter::DidGetFileInfo, 81 url_, base::Bind(&SandboxFileStreamWriter::DidGetFileInfo,
78 weak_factory_.GetWeakPtr(), write_task)); 82 weak_factory_.GetWeakPtr(), write_task));
79 return net::ERR_IO_PENDING; 83 return net::ERR_IO_PENDING;
80 } 84 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 return false; 228 return false;
225 229
226 net::CompletionCallback pending_cancel = cancel_callback_; 230 net::CompletionCallback pending_cancel = cancel_callback_;
227 has_pending_operation_ = false; 231 has_pending_operation_ = false;
228 cancel_callback_.Reset(); 232 cancel_callback_.Reset();
229 pending_cancel.Run(net::OK); 233 pending_cancel.Run(net::OK);
230 return true; 234 return true;
231 } 235 }
232 236
233 } // namespace fileapi 237 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/media/native_media_file_util_unittest.cc ('k') | webkit/tools/test_shell/simple_file_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698