OLD | NEW |
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/profiles/profile_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 done_creating->Wait(); | 216 done_creating->Wait(); |
217 } | 217 } |
218 | 218 |
219 // Initiates creation of profile directory on |sequenced_task_runner| and | 219 // Initiates creation of profile directory on |sequenced_task_runner| and |
220 // ensures that FILE thread is blocked until that operation finishes. If | 220 // ensures that FILE thread is blocked until that operation finishes. If |
221 // |create_readme| is true, the profile README will be created in the profile | 221 // |create_readme| is true, the profile README will be created in the profile |
222 // directory. | 222 // directory. |
223 void CreateProfileDirectory(base::SequencedTaskRunner* sequenced_task_runner, | 223 void CreateProfileDirectory(base::SequencedTaskRunner* sequenced_task_runner, |
224 const base::FilePath& path, | 224 const base::FilePath& path, |
225 bool create_readme) { | 225 bool create_readme) { |
226 base::WaitableEvent* done_creating = new base::WaitableEvent(false, false); | 226 base::WaitableEvent* done_creating = |
| 227 new base::WaitableEvent(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 228 base::WaitableEvent::InitialState::NOT_SIGNALED); |
227 sequenced_task_runner->PostTask( | 229 sequenced_task_runner->PostTask( |
228 FROM_HERE, base::Bind(&CreateDirectoryAndSignal, path, done_creating, | 230 FROM_HERE, base::Bind(&CreateDirectoryAndSignal, path, done_creating, |
229 create_readme)); | 231 create_readme)); |
230 // Block the FILE thread until directory is created on I/O pool to make sure | 232 // Block the FILE thread until directory is created on I/O pool to make sure |
231 // that we don't attempt any operation until that part completes. | 233 // that we don't attempt any operation until that part completes. |
232 BrowserThread::PostTask( | 234 BrowserThread::PostTask( |
233 BrowserThread::FILE, FROM_HERE, | 235 BrowserThread::FILE, FROM_HERE, |
234 base::Bind(&BlockFileThreadOnDirectoryCreate, | 236 base::Bind(&BlockFileThreadOnDirectoryCreate, |
235 base::Owned(done_creating))); | 237 base::Owned(done_creating))); |
236 } | 238 } |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { | 1256 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { |
1255 domain_reliability::DomainReliabilityService* service = | 1257 domain_reliability::DomainReliabilityService* service = |
1256 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1258 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
1257 GetForBrowserContext(this); | 1259 GetForBrowserContext(this); |
1258 if (!service) | 1260 if (!service) |
1259 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1261 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); |
1260 | 1262 |
1261 return service->CreateMonitor( | 1263 return service->CreateMonitor( |
1262 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 1264 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
1263 } | 1265 } |
OLD | NEW |