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

Side by Side Diff: chrome/browser/supervised_user/experimental/supervised_user_blacklist.cc

Issue 1104643003: Supervised users: Post blocking pool tasks with CONTINUE_SHUTDOWN behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@issue388560
Patch Set: Created 5 years, 8 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 return std::binary_search(host_hashes_.begin(), host_hashes_.end(), hash); 68 return std::binary_search(host_hashes_.begin(), host_hashes_.end(), hash);
69 } 69 }
70 70
71 size_t SupervisedUserBlacklist::GetEntryCount() const { 71 size_t SupervisedUserBlacklist::GetEntryCount() const {
72 return host_hashes_.size(); 72 return host_hashes_.size();
73 } 73 }
74 74
75 void SupervisedUserBlacklist::ReadFromFile(const base::FilePath& path, 75 void SupervisedUserBlacklist::ReadFromFile(const base::FilePath& path,
76 const base::Closure& done_callback) { 76 const base::Closure& done_callback) {
77 base::PostTaskAndReplyWithResult( 77 base::PostTaskAndReplyWithResult(
78 BrowserThread::GetBlockingPool(), 78 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
79 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN).get(),
79 FROM_HERE, 80 FROM_HERE,
80 base::Bind(&ReadFromBinaryFileOnFileThread, path), 81 base::Bind(&ReadFromBinaryFileOnFileThread, path),
81 base::Bind(&SupervisedUserBlacklist::OnReadFromFileCompleted, 82 base::Bind(&SupervisedUserBlacklist::OnReadFromFileCompleted,
82 weak_ptr_factory_.GetWeakPtr(), 83 weak_ptr_factory_.GetWeakPtr(),
83 done_callback)); 84 done_callback));
84 } 85 }
85 86
86 void SupervisedUserBlacklist::OnReadFromFileCompleted( 87 void SupervisedUserBlacklist::OnReadFromFileCompleted(
87 const base::Closure& done_callback, 88 const base::Closure& done_callback,
88 scoped_ptr<std::vector<Hash> > host_hashes) { 89 scoped_ptr<std::vector<Hash> > host_hashes) {
89 host_hashes_.swap(*host_hashes); 90 host_hashes_.swap(*host_hashes);
90 LOG_IF(WARNING, host_hashes_.empty()) << "Got empty blacklist"; 91 LOG_IF(WARNING, host_hashes_.empty()) << "Got empty blacklist";
91 92
92 if (!done_callback.is_null()) 93 if (!done_callback.is_null())
93 done_callback.Run(); 94 done_callback.Run();
94 } 95 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698