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

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

Issue 2799333002: Clear the received slices in DownloadItemImpl when etag changed. (Closed)
Patch Set: Address the uma issue. Created 3 years, 8 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
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/download_manager_impl.h" 5 #include "content/browser/download/download_manager_impl.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 delegate_->GetSaveDir(GetBrowserContext(), &website_save_directory, 364 delegate_->GetSaveDir(GetBrowserContext(), &website_save_directory,
365 &default_download_directory, &skip_dir_check); 365 &default_download_directory, &skip_dir_check);
366 } 366 }
367 367
368 std::unique_ptr<DownloadFile> download_file; 368 std::unique_ptr<DownloadFile> download_file;
369 369
370 if (info->result == DOWNLOAD_INTERRUPT_REASON_NONE) { 370 if (info->result == DOWNLOAD_INTERRUPT_REASON_NONE) {
371 DCHECK(stream.get()); 371 DCHECK(stream.get());
372 download_file.reset(file_factory_->CreateFile( 372 download_file.reset(file_factory_->CreateFile(
373 std::move(info->save_info), default_download_directory, 373 std::move(info->save_info), default_download_directory,
374 std::move(stream), download->GetReceivedSlices(), 374 std::move(stream), download->GetNetLogWithSource(),
375 download->GetNetLogWithSource(),
376 download->DestinationObserverAsWeakPtr())); 375 download->DestinationObserverAsWeakPtr()));
377 } 376 }
378 // It is important to leave info->save_info intact in the case of an interrupt 377 // It is important to leave info->save_info intact in the case of an interrupt
379 // so that the DownloadItem can salvage what it can out of a failed resumption 378 // so that the DownloadItem can salvage what it can out of a failed resumption
380 // attempt. 379 // attempt.
381 380
382 download->Start(std::move(download_file), std::move(info->request_handle), 381 download->Start(std::move(download_file), std::move(info->request_handle),
383 *info); 382 *info);
384 383
385 // For interrupted downloads, Start() will transition the state to 384 // For interrupted downloads, Start() will transition the state to
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 if (delegate_) 747 if (delegate_)
749 delegate_->OpenDownload(download); 748 delegate_->OpenDownload(download);
750 } 749 }
751 750
752 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { 751 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) {
753 if (delegate_) 752 if (delegate_)
754 delegate_->ShowDownloadInShell(download); 753 delegate_->ShowDownloadInShell(download);
755 } 754 }
756 755
757 } // namespace content 756 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_item_impl_unittest.cc ('k') | content/browser/download/download_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698