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

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

Issue 814113007: [fsp] Do not close files which failed to open for reading and writing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | chrome/browser/chromeos/file_system_provider/fileapi/file_stream_writer.cc » ('j') | 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_reade r.h" 5 #include "chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reade r.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "chrome/browser/chromeos/file_system_provider/fileapi/provider_async_fi le_util.h" 10 #include "chrome/browser/chromeos/file_system_provider/fileapi/provider_async_fi le_util.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 virtual ~OperationRunner() {} 154 virtual ~OperationRunner() {}
155 155
156 // Remembers a file handle for further operations and forwards the result to 156 // Remembers a file handle for further operations and forwards the result to
157 // the IO thread. 157 // the IO thread.
158 void OnOpenFileCompletedOnUIThread( 158 void OnOpenFileCompletedOnUIThread(
159 const storage::AsyncFileUtil::StatusCallback& callback, 159 const storage::AsyncFileUtil::StatusCallback& callback,
160 int file_handle, 160 int file_handle,
161 base::File::Error result) { 161 base::File::Error result) {
162 DCHECK_CURRENTLY_ON(BrowserThread::UI); 162 DCHECK_CURRENTLY_ON(BrowserThread::UI);
163 163
164 file_handle_ = file_handle; 164 if (result == base::File::FILE_OK)
165 file_handle_ = file_handle;
166
165 BrowserThread::PostTask( 167 BrowserThread::PostTask(
166 BrowserThread::IO, FROM_HERE, base::Bind(callback, result)); 168 BrowserThread::IO, FROM_HERE, base::Bind(callback, result));
167 } 169 }
168 170
169 // Forwards a metadata to the IO thread. 171 // Forwards a metadata to the IO thread.
170 void OnGetMetadataCompletedOnUIThread( 172 void OnGetMetadataCompletedOnUIThread(
171 const ProvidedFileSystemInterface::GetMetadataCallback& callback, 173 const ProvidedFileSystemInterface::GetMetadataCallback& callback,
172 scoped_ptr<EntryMetadata> metadata, 174 scoped_ptr<EntryMetadata> metadata,
173 base::File::Error result) { 175 base::File::Error result) {
174 DCHECK_CURRENTLY_ON(BrowserThread::UI); 176 DCHECK_CURRENTLY_ON(BrowserThread::UI);
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 callback.Run(net::ERR_UPLOAD_FILE_CHANGED); 489 callback.Run(net::ERR_UPLOAD_FILE_CHANGED);
488 return; 490 return;
489 } 491 }
490 492
491 DCHECK_EQ(base::File::FILE_OK, result); 493 DCHECK_EQ(base::File::FILE_OK, result);
492 callback.Run(metadata->size); 494 callback.Run(metadata->size);
493 } 495 }
494 496
495 } // namespace file_system_provider 497 } // namespace file_system_provider
496 } // namespace chromeos 498 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/file_system_provider/fileapi/file_stream_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698