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

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

Issue 8404049: Added member data to classes to support download resumption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with trunk Created 9 years 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 | « content/browser/download/save_file.cc ('k') | content/browser/download/save_package.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "content/browser/download/save_file_manager.h" 7 #include "content/browser/download/save_file_manager.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 206 }
207 207
208 // Notifications sent from the IO thread and run on the file thread: 208 // Notifications sent from the IO thread and run on the file thread:
209 209
210 // The IO thread created |info|, but the file thread (this method) uses it 210 // The IO thread created |info|, but the file thread (this method) uses it
211 // to create a SaveFile which will hold and finally destroy |info|. It will 211 // to create a SaveFile which will hold and finally destroy |info|. It will
212 // then passes |info| to the UI thread for reporting saving status. 212 // then passes |info| to the UI thread for reporting saving status.
213 void SaveFileManager::StartSave(SaveFileCreateInfo* info) { 213 void SaveFileManager::StartSave(SaveFileCreateInfo* info) {
214 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 214 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
215 DCHECK(info); 215 DCHECK(info);
216 SaveFile* save_file = new SaveFile(info); 216 // No need to calculate hash.
217 SaveFile* save_file = new SaveFile(info, false);
217 218
218 // TODO(phajdan.jr): We should check the return value and handle errors here. 219 // TODO(phajdan.jr): We should check the return value and handle errors here.
219 save_file->Initialize(false); // No need to calculate hash. 220 save_file->Initialize();
220 221
221 DCHECK(!LookupSaveFile(info->save_id)); 222 DCHECK(!LookupSaveFile(info->save_id));
222 save_file_map_[info->save_id] = save_file; 223 save_file_map_[info->save_id] = save_file;
223 info->path = save_file->FullPath(); 224 info->path = save_file->FullPath();
224 225
225 BrowserThread::PostTask( 226 BrowserThread::PostTask(
226 BrowserThread::UI, FROM_HERE, 227 BrowserThread::UI, FROM_HERE,
227 base::Bind(&SaveFileManager::OnStartSave, this, info)); 228 base::Bind(&SaveFileManager::OnStartSave, this, info));
228 } 229 }
229 230
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 SaveFileMap::iterator it = save_file_map_.find(*i); 514 SaveFileMap::iterator it = save_file_map_.find(*i);
514 if (it != save_file_map_.end()) { 515 if (it != save_file_map_.end()) {
515 SaveFile* save_file = it->second; 516 SaveFile* save_file = it->second;
516 DCHECK(!save_file->InProgress()); 517 DCHECK(!save_file->InProgress());
517 file_util::Delete(save_file->FullPath(), false); 518 file_util::Delete(save_file->FullPath(), false);
518 delete save_file; 519 delete save_file;
519 save_file_map_.erase(it); 520 save_file_map_.erase(it);
520 } 521 }
521 } 522 }
522 } 523 }
OLDNEW
« no previous file with comments | « content/browser/download/save_file.cc ('k') | content/browser/download/save_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698