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

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

Issue 296933016: Avoid trying to delete a non-existent file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
« no previous file with comments | « base/file_util_win.cc ('k') | 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 (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/files/file.h" 9 #include "base/files/file.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 bound_net_log_.AddEvent(net::NetLog::TYPE_DOWNLOAD_FILE_DETACHED); 175 bound_net_log_.AddEvent(net::NetLog::TYPE_DOWNLOAD_FILE_DETACHED);
176 } 176 }
177 177
178 void BaseFile::Cancel() { 178 void BaseFile::Cancel() {
179 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 179 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
180 DCHECK(!detached_); 180 DCHECK(!detached_);
181 181
182 bound_net_log_.AddEvent(net::NetLog::TYPE_CANCELLED); 182 bound_net_log_.AddEvent(net::NetLog::TYPE_CANCELLED);
183 183
184 Close(); 184 Close();
185 Detach();
Randy Smith (Not in Mondays) 2014/05/23 19:05:21 Hmmm. I'm a bit uncomfortable with the abstractio
185 186
186 if (!full_path_.empty()) { 187 if (!full_path_.empty()) {
187 bound_net_log_.AddEvent(net::NetLog::TYPE_DOWNLOAD_FILE_DELETED); 188 bound_net_log_.AddEvent(net::NetLog::TYPE_DOWNLOAD_FILE_DELETED);
188 189
189 base::DeleteFile(full_path_, false); 190 base::DeleteFile(full_path_, false);
190 } 191 }
191 } 192 }
192 193
193 void BaseFile::Finish() { 194 void BaseFile::Finish() {
194 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 195 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 const char* operation, 337 const char* operation,
337 int os_error, 338 int os_error,
338 DownloadInterruptReason reason) { 339 DownloadInterruptReason reason) {
339 bound_net_log_.AddEvent( 340 bound_net_log_.AddEvent(
340 net::NetLog::TYPE_DOWNLOAD_FILE_ERROR, 341 net::NetLog::TYPE_DOWNLOAD_FILE_ERROR,
341 base::Bind(&FileInterruptedNetLogCallback, operation, os_error, reason)); 342 base::Bind(&FileInterruptedNetLogCallback, operation, os_error, reason));
342 return reason; 343 return reason;
343 } 344 }
344 345
345 } // namespace content 346 } // namespace content
OLDNEW
« no previous file with comments | « base/file_util_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698