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

Side by Side Diff: chrome/browser/safe_browsing/download_protection_service.cc

Issue 2858073002: Use constexpr TaskTraits constructor in chrome. (Closed)
Patch Set: Created 3 years, 7 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 "chrome/browser/safe_browsing/download_protection_service.h" 5 #include "chrome/browser/safe_browsing/download_protection_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 base::BindOnce(&CheckClientDownloadRequest::StartTimeout, this)); 664 base::BindOnce(&CheckClientDownloadRequest::StartTimeout, this));
665 } 665 }
666 666
667 void StartExtractFileFeatures() { 667 void StartExtractFileFeatures() {
668 DCHECK_CURRENTLY_ON(BrowserThread::UI); 668 DCHECK_CURRENTLY_ON(BrowserThread::UI);
669 DCHECK(item_); // Called directly from Start(), item should still exist. 669 DCHECK(item_); // Called directly from Start(), item should still exist.
670 // Since we do blocking I/O, offload this to a worker thread. 670 // Since we do blocking I/O, offload this to a worker thread.
671 // The task does not need to block shutdown. 671 // The task does not need to block shutdown.
672 base::PostTaskWithTraits( 672 base::PostTaskWithTraits(
673 FROM_HERE, 673 FROM_HERE,
674 base::TaskTraits() 674 {base::MayBlock(), base::TaskPriority::BACKGROUND,
675 .MayBlock() 675 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
676 .WithPriority(base::TaskPriority::BACKGROUND)
677 .WithShutdownBehavior(
678 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN),
679 base::BindOnce(&CheckClientDownloadRequest::ExtractFileFeatures, this, 676 base::BindOnce(&CheckClientDownloadRequest::ExtractFileFeatures, this,
680 item_->GetFullPath())); 677 item_->GetFullPath()));
681 } 678 }
682 679
683 void ExtractFileFeatures(const base::FilePath& file_path) { 680 void ExtractFileFeatures(const base::FilePath& file_path) {
684 base::TimeTicks start_time = base::TimeTicks::Now(); 681 base::TimeTicks start_time = base::TimeTicks::Now();
685 binary_feature_extractor_->CheckSignature(file_path, &signature_info_); 682 binary_feature_extractor_->CheckSignature(file_path, &signature_info_);
686 bool is_signed = (signature_info_.certificate_chain_size() > 0); 683 bool is_signed = (signature_info_.certificate_chain_size() > 0);
687 if (is_signed) { 684 if (is_signed) {
688 DVLOG(2) << "Downloaded a signed binary: " << file_path.value(); 685 DVLOG(2) << "Downloaded a signed binary: " << file_path.value();
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 out_request->mutable_referrer_chain()); 1996 out_request->mutable_referrer_chain());
2000 UMA_HISTOGRAM_COUNTS_100( 1997 UMA_HISTOGRAM_COUNTS_100(
2001 "SafeBrowsing.ReferrerURLChainSize.PPAPIDownloadAttribution", 1998 "SafeBrowsing.ReferrerURLChainSize.PPAPIDownloadAttribution",
2002 out_request->referrer_chain_size()); 1999 out_request->referrer_chain_size());
2003 UMA_HISTOGRAM_ENUMERATION( 2000 UMA_HISTOGRAM_ENUMERATION(
2004 "SafeBrowsing.ReferrerAttributionResult.PPAPIDownloadAttribution", result, 2001 "SafeBrowsing.ReferrerAttributionResult.PPAPIDownloadAttribution", result,
2005 SafeBrowsingNavigationObserverManager::ATTRIBUTION_FAILURE_TYPE_MAX); 2002 SafeBrowsingNavigationObserverManager::ATTRIBUTION_FAILURE_TYPE_MAX);
2006 } 2003 }
2007 2004
2008 } // namespace safe_browsing 2005 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698