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

Side by Side Diff: chrome/browser/safe_browsing/sandboxed_zip_analyzer.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/sandboxed_zip_analyzer.h" 5 #include "chrome/browser/safe_browsing/sandboxed_zip_analyzer.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/task_scheduler/post_task.h" 11 #include "base/task_scheduler/post_task.h"
12 #include "chrome/common/safe_browsing/zip_analyzer_results.h" 12 #include "chrome/common/safe_browsing/zip_analyzer_results.h"
13 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
16 16
17 namespace safe_browsing { 17 namespace safe_browsing {
18 18
19 SandboxedZipAnalyzer::SandboxedZipAnalyzer(const base::FilePath& zip_file, 19 SandboxedZipAnalyzer::SandboxedZipAnalyzer(const base::FilePath& zip_file,
20 const ResultCallback& callback) 20 const ResultCallback& callback)
21 : file_path_(zip_file), callback_(callback) { 21 : file_path_(zip_file), callback_(callback) {
22 DCHECK(callback); 22 DCHECK(callback);
23 } 23 }
24 24
25 void SandboxedZipAnalyzer::Start() { 25 void SandboxedZipAnalyzer::Start() {
26 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 26 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
27 27
28 base::PostTaskWithTraits( 28 base::PostTaskWithTraits(
29 FROM_HERE, 29 FROM_HERE,
30 base::TaskTraits() 30 {base::MayBlock(), base::TaskPriority::BACKGROUND,
31 .MayBlock() 31 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
32 .WithPriority(base::TaskPriority::BACKGROUND)
33 .WithShutdownBehavior(
34 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN),
35 base::BindOnce(&SandboxedZipAnalyzer::PrepareFileToAnalyze, this)); 32 base::BindOnce(&SandboxedZipAnalyzer::PrepareFileToAnalyze, this));
36 } 33 }
37 34
38 SandboxedZipAnalyzer::~SandboxedZipAnalyzer() = default; 35 SandboxedZipAnalyzer::~SandboxedZipAnalyzer() = default;
39 36
40 void SandboxedZipAnalyzer::PrepareFileToAnalyze() { 37 void SandboxedZipAnalyzer::PrepareFileToAnalyze() {
41 base::File file(file_path_, base::File::FLAG_OPEN | base::File::FLAG_READ); 38 base::File file(file_path_, base::File::FLAG_OPEN | base::File::FLAG_READ);
42 39
43 if (!file.IsValid()) { 40 if (!file.IsValid()) {
44 DLOG(ERROR) << "Could not open file: " << file_path_.value(); 41 DLOG(ERROR) << "Could not open file: " << file_path_.value();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 90 }
94 91
95 void SandboxedZipAnalyzer::AnalyzeFileDone(const Results& results) { 92 void SandboxedZipAnalyzer::AnalyzeFileDone(const Results& results) {
96 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 93 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
97 94
98 utility_process_mojo_client_.reset(); 95 utility_process_mojo_client_.reset();
99 callback_.Run(results); 96 callback_.Run(results);
100 } 97 }
101 98
102 } // namespace safe_browsing 99 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/sandboxed_dmg_analyzer_mac.cc ('k') | chrome/browser/search/local_files_ntp_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698