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

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

Issue 1815363002: Add RetainedRef uses where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/save_file_resource_handler.h" 5 #include "content/browser/download/save_file_resource_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 bool SaveFileResourceHandler::OnReadCompleted(int bytes_read, bool* defer) { 80 bool SaveFileResourceHandler::OnReadCompleted(int bytes_read, bool* defer) {
81 DCHECK(read_buffer_.get()); 81 DCHECK(read_buffer_.get());
82 // We are passing ownership of this buffer to the save file manager. 82 // We are passing ownership of this buffer to the save file manager.
83 scoped_refptr<net::IOBuffer> buffer; 83 scoped_refptr<net::IOBuffer> buffer;
84 read_buffer_.swap(buffer); 84 read_buffer_.swap(buffer);
85 BrowserThread::PostTask( 85 BrowserThread::PostTask(
86 BrowserThread::FILE, FROM_HERE, 86 BrowserThread::FILE, FROM_HERE,
87 base::Bind(&SaveFileManager::UpdateSaveProgress, save_manager_, 87 base::Bind(&SaveFileManager::UpdateSaveProgress, save_manager_,
88 save_item_id_, buffer, bytes_read)); 88 save_item_id_, base::RetainedRef(buffer), bytes_read));
89 return true; 89 return true;
90 } 90 }
91 91
92 void SaveFileResourceHandler::OnResponseCompleted( 92 void SaveFileResourceHandler::OnResponseCompleted(
93 const net::URLRequestStatus& status, 93 const net::URLRequestStatus& status,
94 const std::string& security_info, 94 const std::string& security_info,
95 bool* defer) { 95 bool* defer) {
96 BrowserThread::PostTask( 96 BrowserThread::PostTask(
97 BrowserThread::FILE, FROM_HERE, 97 BrowserThread::FILE, FROM_HERE,
98 base::Bind(&SaveFileManager::SaveFinished, save_manager_, save_item_id_, 98 base::Bind(&SaveFileManager::SaveFinished, save_manager_, save_item_id_,
99 save_package_id_, 99 save_package_id_,
100 status.is_success() && !status.is_io_pending())); 100 status.is_success() && !status.is_io_pending()));
101 read_buffer_ = NULL; 101 read_buffer_ = NULL;
102 } 102 }
103 103
104 void SaveFileResourceHandler::OnDataDownloaded(int bytes_downloaded) { 104 void SaveFileResourceHandler::OnDataDownloaded(int bytes_downloaded) {
105 NOTREACHED(); 105 NOTREACHED();
106 } 106 }
107 107
108 void SaveFileResourceHandler::set_content_length( 108 void SaveFileResourceHandler::set_content_length(
109 const std::string& content_length) { 109 const std::string& content_length) {
110 base::StringToInt64(content_length, &content_length_); 110 base::StringToInt64(content_length, &content_length_);
111 } 111 }
112 112
113 } // namespace content 113 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/dom_storage/dom_storage_context_wrapper.cc ('k') | content/browser/download/save_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698