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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/fileapi/file_stream_writer.cc

Issue 497013003: [fsp] Fix aborting in File Stream Writer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/chromeos/file_system_provider/fileapi/file_stream_write r.h" 5 #include "chrome/browser/chromeos/file_system_provider/fileapi/file_stream_write r.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "chrome/browser/chromeos/file_system_provider/fileapi/provider_async_fi le_util.h" 9 #include "chrome/browser/chromeos/file_system_provider/fileapi/provider_async_fi le_util.h"
10 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h" 10 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 56
57 // Closes a file. Ignores result, since outlives the caller. Must be called on 57 // Closes a file. Ignores result, since outlives the caller. Must be called on
58 // UI thread. 58 // UI thread.
59 void CloseFileOnUIThread() { 59 void CloseFileOnUIThread() {
60 DCHECK_CURRENTLY_ON(BrowserThread::UI); 60 DCHECK_CURRENTLY_ON(BrowserThread::UI);
61 if (file_system_.get() && file_handle_ != -1) { 61 if (file_system_.get() && file_handle_ != -1) {
62 // Closing a file must not be aborted, since we could end up on files 62 // Closing a file must not be aborted, since we could end up on files
63 // which are never closed. 63 // which are never closed.
64 file_system_->CloseFile(file_handle_, base::Bind(&EmptyStatusCallback)); 64 file_system_->CloseFile(file_handle_, base::Bind(&EmptyStatusCallback));
65 abort_callback_ = ProvidedFileSystemInterface::AbortCallback();
66 } 65 }
67 } 66 }
68 67
69 // Requests writing bytes to the file. In case of either success or a failure 68 // Requests writing bytes to the file. In case of either success or a failure
70 // |callback| is executed. Must be called on UI thread. 69 // |callback| is executed. Must be called on UI thread.
71 void WriteFileOnUIThread( 70 void WriteFileOnUIThread(
72 scoped_refptr<net::IOBuffer> buffer, 71 scoped_refptr<net::IOBuffer> buffer,
73 int64 offset, 72 int64 offset,
74 int length, 73 int length,
75 const storage::AsyncFileUtil::StatusCallback& callback) { 74 const storage::AsyncFileUtil::StatusCallback& callback) {
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 current_offset_, 329 current_offset_,
331 buffer_length, 330 buffer_length,
332 base::Bind(&FileStreamWriter::OnWriteFileCompleted, 331 base::Bind(&FileStreamWriter::OnWriteFileCompleted,
333 weak_ptr_factory_.GetWeakPtr(), 332 weak_ptr_factory_.GetWeakPtr(),
334 buffer_length, 333 buffer_length,
335 callback))); 334 callback)));
336 } 335 }
337 336
338 } // namespace file_system_provider 337 } // namespace file_system_provider
339 } // namespace chromeos 338 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698