1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
content / browser / indexed_db / instance / fake_transaction.cc [blame]
// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/indexed_db/instance/fake_transaction.h"
#include <utility>
#include "base/files/file_path.h"
#include "base/no_destructor.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/sequenced_task_runner.h"
#include "components/services/storage/indexed_db/transactional_leveldb/transactional_leveldb_database.h"
#include "components/services/storage/indexed_db/transactional_leveldb/transactional_leveldb_factory.h"
#include "components/services/storage/public/cpp/buckets/bucket_locator.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
namespace content::indexed_db {
FakeTransaction::FakeTransaction(Status result)
: FakeTransaction(result,
blink::mojom::IDBTransactionMode::ReadWrite,
nullptr) {}
FakeTransaction::FakeTransaction(Status result,
blink::mojom::IDBTransactionMode mode,
base::WeakPtr<BackingStore> backing_store)
: BackingStore::Transaction(backing_store,
blink::mojom::IDBTransactionDurability::Relaxed,
mode),
result_(result) {}
void FakeTransaction::Begin(std::vector<PartitionedLock> locks) {
if (backing_store()) {
Transaction::Begin(std::move(locks));
}
}
Status FakeTransaction::CommitPhaseOne(BlobWriteCallback callback) {
return std::move(callback).Run(
BlobWriteResult::kRunPhaseTwoAndReturnResult,
storage::mojom::WriteBlobToFileResult::kSuccess);
}
Status FakeTransaction::CommitPhaseTwo() {
return result_;
}
uint64_t FakeTransaction::GetTransactionSize() {
return 0;
}
void FakeTransaction::Rollback() {}
} // namespace content::indexed_db