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

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

Issue 1159623009: content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test build fix. Created 5 years, 6 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_resource_handler.h" 5 #include "content/browser/download/download_resource_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/message_loop/message_loop_proxy.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/metrics/sparse_histogram.h" 13 #include "base/metrics/sparse_histogram.h"
14 #include "base/single_thread_task_runner.h"
14 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "base/thread_task_runner_handle.h"
15 #include "content/browser/byte_stream.h" 17 #include "content/browser/byte_stream.h"
16 #include "content/browser/download/download_create_info.h" 18 #include "content/browser/download/download_create_info.h"
17 #include "content/browser/download/download_interrupt_reasons_impl.h" 19 #include "content/browser/download/download_interrupt_reasons_impl.h"
18 #include "content/browser/download/download_manager_impl.h" 20 #include "content/browser/download/download_manager_impl.h"
19 #include "content/browser/download/download_request_handle.h" 21 #include "content/browser/download/download_request_handle.h"
20 #include "content/browser/download/download_stats.h" 22 #include "content/browser/download/download_stats.h"
21 #include "content/browser/loader/resource_dispatcher_host_impl.h" 23 #include "content/browser/loader/resource_dispatcher_host_impl.h"
22 #include "content/browser/loader/resource_request_info_impl.h" 24 #include "content/browser/loader/resource_request_info_impl.h"
23 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
24 #include "content/public/browser/download_interrupt_reasons.h" 26 #include "content/public/browser/download_interrupt_reasons.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 new DownloadCreateInfo(base::Time::Now(), 186 new DownloadCreateInfo(base::Time::Now(),
185 content_length, 187 content_length,
186 request()->net_log(), 188 request()->net_log(),
187 request_info->HasUserGesture(), 189 request_info->HasUserGesture(),
188 request_info->GetPageTransition(), 190 request_info->GetPageTransition(),
189 save_info_.Pass())); 191 save_info_.Pass()));
190 192
191 // Create the ByteStream for sending data to the download sink. 193 // Create the ByteStream for sending data to the download sink.
192 scoped_ptr<ByteStreamReader> stream_reader; 194 scoped_ptr<ByteStreamReader> stream_reader;
193 CreateByteStream( 195 CreateByteStream(
194 base::MessageLoopProxy::current(), 196 base::ThreadTaskRunnerHandle::Get(),
195 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), 197 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE),
196 kDownloadByteStreamSize, &stream_writer_, &stream_reader); 198 kDownloadByteStreamSize, &stream_writer_, &stream_reader);
197 stream_writer_->RegisterCallback( 199 stream_writer_->RegisterCallback(
198 base::Bind(&DownloadResourceHandler::ResumeRequest, AsWeakPtr())); 200 base::Bind(&DownloadResourceHandler::ResumeRequest, AsWeakPtr()));
199 201
200 info->download_id = download_id_; 202 info->download_id = download_id_;
201 info->url_chain = request()->url_chain(); 203 info->url_chain = request()->url_chain();
202 info->referrer_url = GURL(request()->referrer()); 204 info->referrer_url = GURL(request()->referrer());
203 info->mime_type = response->head.mime_type; 205 info->mime_type = response->head.mime_type;
204 info->remote_address = request()->GetSocketAddress().host(); 206 info->remote_address = request()->GetSocketAddress().host();
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 BrowserThread::PostTask( 542 BrowserThread::PostTask(
541 BrowserThread::UI, FROM_HERE, 543 BrowserThread::UI, FROM_HERE,
542 base::Bind(&DeleteOnUIThread, base::Passed(&tab_info_))); 544 base::Bind(&DeleteOnUIThread, base::Passed(&tab_info_)));
543 } 545 }
544 546
545 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", 547 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration",
546 base::TimeTicks::Now() - download_start_time_); 548 base::TimeTicks::Now() - download_start_time_);
547 } 549 }
548 550
549 } // namespace content 551 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_file_unittest.cc ('k') | content/browser/download/drag_download_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698