| Index: components/leveldb/leveldb_file_thread.h
|
| diff --git a/components/leveldb/leveldb_file_thread.h b/components/leveldb/leveldb_file_thread.h
|
| index dc051a4777c3026e89aadb22579ec537bd8d879c..769c324220784aa083ed3e67d65be2d211f532b1 100644
|
| --- a/components/leveldb/leveldb_file_thread.h
|
| +++ b/components/leveldb/leveldb_file_thread.h
|
| @@ -5,7 +5,10 @@
|
| #ifndef COMPONENTS_LEVELDB_LEVELDB_FILE_THREAD_H_
|
| #define COMPONENTS_LEVELDB_LEVELDB_FILE_THREAD_H_
|
|
|
| +#include <map>
|
| #include <string>
|
| +#include <utility>
|
| +#include <vector>
|
|
|
| #include "base/files/file.h"
|
| #include "base/memory/ref_counted.h"
|
| @@ -96,6 +99,22 @@ class LevelDBFileThread : public base::Thread,
|
| friend class base::RefCountedThreadSafe<LevelDBFileThread>;
|
| ~LevelDBFileThread() override;
|
|
|
| + // Called from the beginning of most impls which take an OpaqueDir. Returns
|
| + // true if the directory was unbound between the time the task was posted and
|
| + // the task was run on this thread. If it was, no further processing should
|
| + // be done (and the waitable event will be Signal()ed).
|
| + bool RegisterDirAndWaitableEvent(OpaqueDir* dir,
|
| + base::WaitableEvent* done_event);
|
| +
|
| + // Cleans up internal state related to the waitable event before Signal()ing
|
| + // it.
|
| + void CompleteWaitableEvent(base::WaitableEvent* done_event);
|
| +
|
| + // Called when one of our directory or files has a connection error. This
|
| + // will find all the outstanding waitable events that depend on it and signal
|
| + // them.
|
| + void OnConnectionError();
|
| +
|
| void RegisterDirectoryImpl(
|
| base::WaitableEvent* done_event,
|
| mojo::InterfacePtrInfo<filesystem::Directory> directory_info,
|
| @@ -217,6 +236,14 @@ class LevelDBFileThread : public base::Thread,
|
|
|
| int outstanding_opaque_dirs_;
|
|
|
| + // When our public methods are called, we create a WaitableEvent on their
|
| + // thread so that we can block their thread on the LevelDBFileThread. We then
|
| + // need to track what DirectoryPtrs and FilePtrs, which if they get closed,
|
| + // should immediately trigger the waitable event.
|
| + struct WaitableEventDependencies;
|
| + std::map<base::WaitableEvent*, WaitableEventDependencies>
|
| + waitable_event_dependencies_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(LevelDBFileThread);
|
| };
|
|
|
|
|