OLD | NEW |
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/save_package.h" | 5 #include "content/browser/download/save_package.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 | 1087 |
1088 if (!data.empty()) { | 1088 if (!data.empty()) { |
1089 // Prepare buffer for saving HTML data. | 1089 // Prepare buffer for saving HTML data. |
1090 scoped_refptr<net::IOBuffer> new_data(new net::IOBuffer(data.size())); | 1090 scoped_refptr<net::IOBuffer> new_data(new net::IOBuffer(data.size())); |
1091 memcpy(new_data->data(), data.data(), data.size()); | 1091 memcpy(new_data->data(), data.data(), data.size()); |
1092 | 1092 |
1093 // Call write file functionality in file thread. | 1093 // Call write file functionality in file thread. |
1094 BrowserThread::PostTask( | 1094 BrowserThread::PostTask( |
1095 BrowserThread::FILE, FROM_HERE, | 1095 BrowserThread::FILE, FROM_HERE, |
1096 base::Bind(&SaveFileManager::UpdateSaveProgress, file_manager_, | 1096 base::Bind(&SaveFileManager::UpdateSaveProgress, file_manager_, |
1097 save_item->id(), new_data, static_cast<int>(data.size()))); | 1097 save_item->id(), base::RetainedRef(new_data), |
| 1098 static_cast<int>(data.size()))); |
1098 } | 1099 } |
1099 | 1100 |
1100 // Current frame is completed saving, call finish in file thread. | 1101 // Current frame is completed saving, call finish in file thread. |
1101 if (end_of_data) { | 1102 if (end_of_data) { |
1102 DVLOG(20) << " " << __FUNCTION__ << "()" | 1103 DVLOG(20) << " " << __FUNCTION__ << "()" |
1103 << " save_item_id = " << save_item->id() << " url = \"" | 1104 << " save_item_id = " << save_item->id() << " url = \"" |
1104 << save_item->url().spec() << "\""; | 1105 << save_item->url().spec() << "\""; |
1105 BrowserThread::PostTask( | 1106 BrowserThread::PostTask( |
1106 BrowserThread::FILE, FROM_HERE, | 1107 BrowserThread::FILE, FROM_HERE, |
1107 base::Bind(&SaveFileManager::SaveFinished, file_manager_, | 1108 base::Bind(&SaveFileManager::SaveFinished, file_manager_, |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1519 | 1520 |
1520 void SavePackage::FinalizeDownloadEntry() { | 1521 void SavePackage::FinalizeDownloadEntry() { |
1521 DCHECK(download_); | 1522 DCHECK(download_); |
1522 DCHECK(download_manager_); | 1523 DCHECK(download_manager_); |
1523 | 1524 |
1524 download_manager_->OnSavePackageSuccessfullyFinished(download_); | 1525 download_manager_->OnSavePackageSuccessfullyFinished(download_); |
1525 StopObservation(); | 1526 StopObservation(); |
1526 } | 1527 } |
1527 | 1528 |
1528 } // namespace content | 1529 } // namespace content |
OLD | NEW |