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

Unified Diff: chrome/browser/download/save_file_manager.cc

Issue 18390: Change URLRequest to use a ref-counted buffer for actual IO.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/download/save_file_manager.h ('k') | chrome/browser/download/save_package.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/save_file_manager.cc
===================================================================
--- chrome/browser/download/save_file_manager.cc (revision 8565)
+++ chrome/browser/download/save_file_manager.cc (working copy)
@@ -25,6 +25,7 @@
#include "chrome/common/win_safe_util.h"
#include "googleurl/src/gurl.h"
#include "net/base/net_util.h"
+#include "net/base/io_buffer.h"
#include "net/url_request/url_request_context.h"
SaveFileManager::SaveFileManager(MessageLoop* ui_loop,
@@ -271,12 +272,12 @@
// thread). We may receive a few more updates before the IO thread gets the
// cancel message. We just delete the data since the SaveFile has been deleted.
void SaveFileManager::UpdateSaveProgress(int save_id,
- char* data,
+ net::IOBuffer* data,
int data_len) {
DCHECK(MessageLoop::current() == GetSaveLoop());
SaveFile* save_file = LookupSaveFile(save_id);
if (save_file) {
- bool write_success = save_file->AppendDataToFile(data, data_len);
+ bool write_success = save_file->AppendDataToFile(data->data(), data_len);
ui_loop_->PostTask(FROM_HERE,
NewRunnableMethod(this,
&SaveFileManager::OnUpdateSaveProgress,
@@ -284,7 +285,7 @@
save_file->bytes_so_far(),
write_success));
}
- delete [] data;
+ data->Release();
}
// The IO thread will call this when saving is completed or it got error when
« no previous file with comments | « chrome/browser/download/save_file_manager.h ('k') | chrome/browser/download/save_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698