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

Side by Side Diff: chrome/browser/safe_browsing/sandboxed_dmg_analyzer_mac.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_dmg_analyzer_mac.h" 5 #include "chrome/browser/safe_browsing/sandboxed_dmg_analyzer_mac.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/task_scheduler/post_task.h" 10 #include "base/task_scheduler/post_task.h"
11 #include "chrome/common/safe_browsing/zip_analyzer_results.h" 11 #include "chrome/common/safe_browsing/zip_analyzer_results.h"
12 #include "chrome/grit/generated_resources.h" 12 #include "chrome/grit/generated_resources.h"
13 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
15 15
16 namespace safe_browsing { 16 namespace safe_browsing {
17 17
18 SandboxedDMGAnalyzer::SandboxedDMGAnalyzer(const base::FilePath& dmg_file, 18 SandboxedDMGAnalyzer::SandboxedDMGAnalyzer(const base::FilePath& dmg_file,
19 const ResultCallback& callback) 19 const ResultCallback& callback)
20 : file_path_(dmg_file), callback_(callback) { 20 : file_path_(dmg_file), callback_(callback) {
21 DCHECK(callback); 21 DCHECK(callback);
22 } 22 }
23 23
24 void SandboxedDMGAnalyzer::Start() { 24 void SandboxedDMGAnalyzer::Start() {
25 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 25 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
26 26
27 base::PostTaskWithTraits( 27 base::PostTaskWithTraits(
28 FROM_HERE, 28 FROM_HERE,
29 base::TaskTraits() 29 {base::MayBlock(), base::TaskPriority::BACKGROUND,
30 .MayBlock() 30 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
31 .WithPriority(base::TaskPriority::BACKGROUND)
32 .WithShutdownBehavior(
33 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN),
34 base::Bind(&SandboxedDMGAnalyzer::PrepareFileToAnalyze, this)); 31 base::Bind(&SandboxedDMGAnalyzer::PrepareFileToAnalyze, this));
35 } 32 }
36 33
37 SandboxedDMGAnalyzer::~SandboxedDMGAnalyzer() = default; 34 SandboxedDMGAnalyzer::~SandboxedDMGAnalyzer() = default;
38 35
39 void SandboxedDMGAnalyzer::PrepareFileToAnalyze() { 36 void SandboxedDMGAnalyzer::PrepareFileToAnalyze() {
40 base::File file(file_path_, base::File::FLAG_OPEN | base::File::FLAG_READ); 37 base::File file(file_path_, base::File::FLAG_OPEN | base::File::FLAG_READ);
41 38
42 if (!file.IsValid()) { 39 if (!file.IsValid()) {
43 DLOG(ERROR) << "Could not open file: " << file_path_.value(); 40 DLOG(ERROR) << "Could not open file: " << file_path_.value();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 74 }
78 75
79 void SandboxedDMGAnalyzer::AnalyzeFileDone(const Results& results) { 76 void SandboxedDMGAnalyzer::AnalyzeFileDone(const Results& results) {
80 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 77 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
81 78
82 utility_process_mojo_client_.reset(); 79 utility_process_mojo_client_.reset();
83 callback_.Run(results); 80 callback_.Run(results);
84 } 81 }
85 82
86 } // namespace safe_browsing 83 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.cc ('k') | chrome/browser/safe_browsing/sandboxed_zip_analyzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698