chromium/components/services/storage/indexed_db/leveldb/leveldb_state.h

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_SERVICES_STORAGE_INDEXED_DB_LEVELDB_LEVELDB_STATE_H_
#define COMPONENTS_SERVICES_STORAGE_INDEXED_DB_LEVELDB_LEVELDB_STATE_H_

#include <atomic>
#include <memory>
#include <utility>

#include "base/files/file_path.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/task/sequenced_task_runner.h"
#include "third_party/leveldatabase/src/include/leveldb/comparator.h"
#include "third_party/leveldatabase/src/include/leveldb/db.h"
#include "third_party/leveldatabase/src/include/leveldb/filter_policy.h"

namespace base {
class WaitableEvent;
}  // namespace base

namespace content {

// Encapsulates a leveldb database and comparator, allowing them to be used
// safely across thread boundaries.
// Because the `RequestDestruction` method is called on shutdown, and blocks
// shutdown, all references to this object MUST be on task runner that
// BLOCK_SHUTDOWN. Otherwise it introduces a potential hang on shutdown.
class LevelDBState : public base::RefCountedThreadSafe<LevelDBState> {};

}  // namespace content

#endif  // COMPONENTS_SERVICES_STORAGE_INDEXED_DB_LEVELDB_LEVELDB_STATE_H_