OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/leveldb/leveldb_mojo_proxy.h" | 5 #include "components/leveldb/leveldb_mojo_proxy.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 | 138 |
139 LevelDBMojoProxy::~LevelDBMojoProxy() { | 139 LevelDBMojoProxy::~LevelDBMojoProxy() { |
140 DCHECK_EQ(0, outstanding_opaque_dirs_); | 140 DCHECK_EQ(0, outstanding_opaque_dirs_); |
141 } | 141 } |
142 | 142 |
143 void LevelDBMojoProxy::RunInternal(const base::Closure& task) { | 143 void LevelDBMojoProxy::RunInternal(const base::Closure& task) { |
144 if (task_runner_->BelongsToCurrentThread()) { | 144 if (task_runner_->BelongsToCurrentThread()) { |
145 task.Run(); | 145 task.Run(); |
146 } else { | 146 } else { |
147 base::WaitableEvent done_event(false, false); | 147 base::WaitableEvent done_event( |
| 148 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 149 base::WaitableEvent::InitialState::NOT_SIGNALED); |
148 task_runner_->PostTask( | 150 task_runner_->PostTask( |
149 FROM_HERE, | 151 FROM_HERE, |
150 base::Bind(&LevelDBMojoProxy::DoOnOtherThread, | 152 base::Bind(&LevelDBMojoProxy::DoOnOtherThread, |
151 this, | 153 this, |
152 task, | 154 task, |
153 base::Unretained(&done_event))); | 155 base::Unretained(&done_event))); |
154 done_event.Wait(); | 156 done_event.Wait(); |
155 } | 157 } |
156 } | 158 } |
157 | 159 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 *out_lock = l; | 322 *out_lock = l; |
321 } | 323 } |
322 } | 324 } |
323 | 325 |
324 void LevelDBMojoProxy::UnlockFileImpl(std::unique_ptr<OpaqueLock> lock, | 326 void LevelDBMojoProxy::UnlockFileImpl(std::unique_ptr<OpaqueLock> lock, |
325 filesystem::mojom::FileError* out_error) { | 327 filesystem::mojom::FileError* out_error) { |
326 lock->lock_file->Unlock(out_error); | 328 lock->lock_file->Unlock(out_error); |
327 } | 329 } |
328 | 330 |
329 } // namespace leveldb | 331 } // namespace leveldb |
OLD | NEW |