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

Side by Side Diff: content/browser/download/base_file.cc

Issue 10701050: net: Implement canceling of all async operations in FileStream. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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
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 "content/browser/download/base_file.h" 5 #include "content/browser/download/base_file.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 303 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
304 304
305 bound_net_log_.AddEvent(net::NetLog::TYPE_DOWNLOAD_FILE_CLOSED); 305 bound_net_log_.AddEvent(net::NetLog::TYPE_DOWNLOAD_FILE_CLOSED);
306 306
307 if (file_stream_.get()) { 307 if (file_stream_.get()) {
308 #if defined(OS_CHROMEOS) 308 #if defined(OS_CHROMEOS)
309 // Currently we don't really care about the return value, since if it fails 309 // Currently we don't really care about the return value, since if it fails
310 // theres not much we can do. But we might in the future. 310 // theres not much we can do. But we might in the future.
311 file_stream_->FlushSync(); 311 file_stream_->FlushSync();
312 #endif 312 #endif
313 file_stream_->CloseSync();
314 ClearStream(); 313 ClearStream();
315 } 314 }
316 } 315 }
317 316
318 void BaseFile::ClearStream() { 317 void BaseFile::ClearStream() {
319 // This should only be called when we have a stream. 318 // This should only be called when we have a stream.
320 DCHECK(file_stream_.get() != NULL); 319 DCHECK(file_stream_.get() != NULL);
321 file_stream_.reset(); 320 file_stream_.reset();
322 bound_net_log_.EndEvent(net::NetLog::TYPE_DOWNLOAD_FILE_OPENED); 321 bound_net_log_.EndEvent(net::NetLog::TYPE_DOWNLOAD_FILE_OPENED);
323 } 322 }
(...skipping 28 matching lines...) Expand all
352 const char* operation, 351 const char* operation,
353 int os_error, 352 int os_error,
354 DownloadInterruptReason reason) { 353 DownloadInterruptReason reason) {
355 bound_net_log_.AddEvent( 354 bound_net_log_.AddEvent(
356 net::NetLog::TYPE_DOWNLOAD_FILE_ERROR, 355 net::NetLog::TYPE_DOWNLOAD_FILE_ERROR,
357 base::Bind(&FileInterruptedNetLogCallback, operation, os_error, reason)); 356 base::Bind(&FileInterruptedNetLogCallback, operation, os_error, reason));
358 return reason; 357 return reason;
359 } 358 }
360 359
361 } // namespace content 360 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698