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

Side by Side Diff: chrome/browser/supervised_user/experimental/supervised_user_blacklist.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/supervised_user/experimental/supervised_user_blacklist. h" 5 #include "chrome/browser/supervised_user/experimental/supervised_user_blacklist. h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 #include <fstream> 9 #include <fstream>
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 size_t SupervisedUserBlacklist::GetEntryCount() const { 67 size_t SupervisedUserBlacklist::GetEntryCount() const {
68 return host_hashes_.size(); 68 return host_hashes_.size();
69 } 69 }
70 70
71 void SupervisedUserBlacklist::ReadFromFile(const base::FilePath& path, 71 void SupervisedUserBlacklist::ReadFromFile(const base::FilePath& path,
72 const base::Closure& done_callback) { 72 const base::Closure& done_callback) {
73 base::PostTaskWithTraitsAndReplyWithResult( 73 base::PostTaskWithTraitsAndReplyWithResult(
74 FROM_HERE, 74 FROM_HERE,
75 base::TaskTraits() 75 {base::MayBlock(), base::TaskPriority::BACKGROUND,
76 .MayBlock() 76 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
77 .WithPriority(base::TaskPriority::BACKGROUND)
78 .WithShutdownBehavior(
79 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN),
80 base::BindOnce(&ReadFromBinaryFileOnFileThread, path), 77 base::BindOnce(&ReadFromBinaryFileOnFileThread, path),
81 base::BindOnce(&SupervisedUserBlacklist::OnReadFromFileCompleted, 78 base::BindOnce(&SupervisedUserBlacklist::OnReadFromFileCompleted,
82 weak_ptr_factory_.GetWeakPtr(), done_callback)); 79 weak_ptr_factory_.GetWeakPtr(), done_callback));
83 } 80 }
84 81
85 void SupervisedUserBlacklist::OnReadFromFileCompleted( 82 void SupervisedUserBlacklist::OnReadFromFileCompleted(
86 const base::Closure& done_callback, 83 const base::Closure& done_callback,
87 std::unique_ptr<std::vector<Hash>> host_hashes) { 84 std::unique_ptr<std::vector<Hash>> host_hashes) {
88 host_hashes_.swap(*host_hashes); 85 host_hashes_.swap(*host_hashes);
89 LOG_IF(WARNING, host_hashes_.empty()) << "Got empty blacklist"; 86 LOG_IF(WARNING, host_hashes_.empty()) << "Got empty blacklist";
90 87
91 if (!done_callback.is_null()) 88 if (!done_callback.is_null())
92 done_callback.Run(); 89 done_callback.Run();
93 } 90 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698