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

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

Issue 2161193003: Use __func__ instead of __FUNCTION__. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resync Created 4 years, 4 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 259
260 void DownloadManagerImpl::SetDelegate(DownloadManagerDelegate* delegate) { 260 void DownloadManagerImpl::SetDelegate(DownloadManagerDelegate* delegate) {
261 delegate_ = delegate; 261 delegate_ = delegate;
262 } 262 }
263 263
264 DownloadManagerDelegate* DownloadManagerImpl::GetDelegate() const { 264 DownloadManagerDelegate* DownloadManagerImpl::GetDelegate() const {
265 return delegate_; 265 return delegate_;
266 } 266 }
267 267
268 void DownloadManagerImpl::Shutdown() { 268 void DownloadManagerImpl::Shutdown() {
269 DVLOG(20) << __FUNCTION__ << "()" 269 DVLOG(20) << __func__ << "() shutdown_needed_ = " << shutdown_needed_;
270 << " shutdown_needed_ = " << shutdown_needed_;
271 if (!shutdown_needed_) 270 if (!shutdown_needed_)
272 return; 271 return;
273 shutdown_needed_ = false; 272 shutdown_needed_ = false;
274 273
275 FOR_EACH_OBSERVER(Observer, observers_, ManagerGoingDown(this)); 274 FOR_EACH_OBSERVER(Observer, observers_, ManagerGoingDown(this));
276 // TODO(benjhayden): Consider clearing observers_. 275 // TODO(benjhayden): Consider clearing observers_.
277 276
278 // If there are in-progress downloads, cancel them. This also goes for 277 // If there are in-progress downloads, cancel them. This also goes for
279 // dangerous downloads which will remain in history if they aren't explicitly 278 // dangerous downloads which will remain in history if they aren't explicitly
280 // accepted or discarded. Canceling will remove the intermediate download 279 // accepted or discarded. Canceling will remove the intermediate download
(...skipping 17 matching lines...) Expand all
298 297
299 void DownloadManagerImpl::StartDownload( 298 void DownloadManagerImpl::StartDownload(
300 std::unique_ptr<DownloadCreateInfo> info, 299 std::unique_ptr<DownloadCreateInfo> info,
301 std::unique_ptr<ByteStreamReader> stream, 300 std::unique_ptr<ByteStreamReader> stream,
302 const DownloadUrlParameters::OnStartedCallback& on_started) { 301 const DownloadUrlParameters::OnStartedCallback& on_started) {
303 DCHECK_CURRENTLY_ON(BrowserThread::UI); 302 DCHECK_CURRENTLY_ON(BrowserThread::UI);
304 DCHECK(info); 303 DCHECK(info);
305 // |stream| is only non-nil if the download request was successful. 304 // |stream| is only non-nil if the download request was successful.
306 DCHECK((info->result == DOWNLOAD_INTERRUPT_REASON_NONE && stream.get()) || 305 DCHECK((info->result == DOWNLOAD_INTERRUPT_REASON_NONE && stream.get()) ||
307 (info->result != DOWNLOAD_INTERRUPT_REASON_NONE && !stream.get())); 306 (info->result != DOWNLOAD_INTERRUPT_REASON_NONE && !stream.get()));
308 DVLOG(20) << __FUNCTION__ << "()" 307 DVLOG(20) << __func__
309 << " result=" << DownloadInterruptReasonToString(info->result); 308 << "() result=" << DownloadInterruptReasonToString(info->result);
310 uint32_t download_id = info->download_id; 309 uint32_t download_id = info->download_id;
311 const bool new_download = (download_id == content::DownloadItem::kInvalidId); 310 const bool new_download = (download_id == content::DownloadItem::kInvalidId);
312 base::Callback<void(uint32_t)> got_id(base::Bind( 311 base::Callback<void(uint32_t)> got_id(base::Bind(
313 &DownloadManagerImpl::StartDownloadWithId, weak_factory_.GetWeakPtr(), 312 &DownloadManagerImpl::StartDownloadWithId, weak_factory_.GetWeakPtr(),
314 base::Passed(&info), base::Passed(&stream), on_started, new_download)); 313 base::Passed(&info), base::Passed(&stream), on_started, new_download));
315 if (new_download) { 314 if (new_download) {
316 GetNextId(got_id); 315 GetNextId(got_id);
317 } else { 316 } else {
318 got_id.Run(download_id); 317 got_id.Run(download_id);
319 } 318 }
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 DCHECK(!ContainsKey(downloads_by_guid_, guid)); 630 DCHECK(!ContainsKey(downloads_by_guid_, guid));
632 DownloadItemImpl* item = item_factory_->CreatePersistedItem( 631 DownloadItemImpl* item = item_factory_->CreatePersistedItem(
633 this, guid, id, current_path, target_path, url_chain, referrer_url, 632 this, guid, id, current_path, target_path, url_chain, referrer_url,
634 site_url, tab_url, tab_refererr_url, mime_type, original_mime_type, 633 site_url, tab_url, tab_refererr_url, mime_type, original_mime_type,
635 start_time, end_time, etag, last_modified, received_bytes, total_bytes, 634 start_time, end_time, etag, last_modified, received_bytes, total_bytes,
636 hash, state, danger_type, interrupt_reason, opened, 635 hash, state, danger_type, interrupt_reason, opened,
637 net::BoundNetLog::Make(net_log_, net::NetLog::SOURCE_DOWNLOAD)); 636 net::BoundNetLog::Make(net_log_, net::NetLog::SOURCE_DOWNLOAD));
638 downloads_[id] = item; 637 downloads_[id] = item;
639 downloads_by_guid_[guid] = item; 638 downloads_by_guid_[guid] = item;
640 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCreated(this, item)); 639 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCreated(this, item));
641 DVLOG(20) << __FUNCTION__ << "() download = " << item->DebugString(true); 640 DVLOG(20) << __func__ << "() download = " << item->DebugString(true);
642 return item; 641 return item;
643 } 642 }
644 643
645 int DownloadManagerImpl::InProgressCount() const { 644 int DownloadManagerImpl::InProgressCount() const {
646 int count = 0; 645 int count = 0;
647 for (const auto& it : downloads_) { 646 for (const auto& it : downloads_) {
648 if (it.second->GetState() == DownloadItem::IN_PROGRESS) 647 if (it.second->GetState() == DownloadItem::IN_PROGRESS)
649 ++count; 648 ++count;
650 } 649 }
651 return count; 650 return count;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 if (delegate_) 695 if (delegate_)
697 delegate_->OpenDownload(download); 696 delegate_->OpenDownload(download);
698 } 697 }
699 698
700 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { 699 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) {
701 if (delegate_) 700 if (delegate_)
702 delegate_->ShowDownloadInShell(download); 701 delegate_->ShowDownloadInShell(download);
703 } 702 }
704 703
705 } // namespace content 704 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_item_impl.cc ('k') | content/browser/download/download_request_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698