chromium/components/services/storage/indexed_db/scopes/leveldb_scopes_tasks.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_SCOPES_LEVELDB_SCOPES_TASKS_H_
#define COMPONENTS_SERVICES_STORAGE_INDEXED_DB_SCOPES_LEVELDB_SCOPES_TASKS_H_

#include <stdint.h>
#include <vector>

#include "base/functional/callback.h"
#include "base/memory/scoped_refptr.h"
#include "base/sequence_checker.h"
#include "components/services/storage/indexed_db/leveldb/leveldb_state.h"
#include "third_party/leveldatabase/src/include/leveldb/status.h"
#include "third_party/leveldatabase/src/include/leveldb/write_batch.h"

namespace leveldb {
struct ReadOptions;
struct WriteOptions;
}  // namespace leveldb

namespace content {

// This base class is thread-compatible, and is designed to be constructed on
// one thread, and then used & destroyed on another.
class LevelDBScopesTask {};

// Deletes the undo log for a given scope, and optionally executes the cleanup
// tasks recorded in the scope.
//
// Note: Tasks are constructed on one thread and then Run() and destroyed on a
// separate thread.
class CleanupScopeTask : private LevelDBScopesTask {};

// This task executes & deletes the undo tasks for the given scope, and then
// marks the scope as committed. It should then be cleaned up by a
// CleanupScopeTask that ignores the cleanup tasks (kIgnoreCleanupTasks).
//
// Note: Tasks are constructed on one thread and then |Run| and destroyed on a
// separate thread.
class RevertScopeTask : private LevelDBScopesTask {};

}  // namespace content

#endif  // COMPONENTS_SERVICES_STORAGE_INDEXED_DB_SCOPES_LEVELDB_SCOPES_TASKS_H_