Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Unified Diff: components/leveldb/leveldb_mojo_proxy.cc

Issue 2649963002: Enable mojo localstorage to actually store on disk. (Closed)
Patch Set: add uma Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/leveldb/leveldb_mojo_proxy.cc
diff --git a/components/leveldb/leveldb_mojo_proxy.cc b/components/leveldb/leveldb_mojo_proxy.cc
index 74446206302c49764ee2051e393359fa5c93b334..8f4008b2432e97b9f881aa9f9880afa5a6d1abf0 100644
--- a/components/leveldb/leveldb_mojo_proxy.cc
+++ b/components/leveldb/leveldb_mojo_proxy.cc
@@ -10,6 +10,7 @@
#include "base/callback.h"
#include "base/single_thread_task_runner.h"
#include "mojo/public/cpp/bindings/interface_request.h"
+#include "mojo/public/cpp/bindings/sync_call_restrictions.h"
namespace leveldb {
@@ -182,6 +183,7 @@ void LevelDBMojoProxy::OpenFileHandleImpl(OpaqueDir* dir,
std::string name,
uint32_t open_flags,
base::File* output_file) {
+ mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync;
base::File file;
filesystem::mojom::FileError error = filesystem::mojom::FileError::FAILED;
bool completed =
@@ -199,6 +201,7 @@ void LevelDBMojoProxy::SyncDirectoryImpl(
OpaqueDir* dir,
std::string name,
filesystem::mojom::FileError* out_error) {
+ mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync;
filesystem::mojom::DirectoryPtr target;
bool completed = dir->directory->OpenDirectory(
name, MakeRequest(&target),
@@ -215,6 +218,7 @@ void LevelDBMojoProxy::SyncDirectoryImpl(
void LevelDBMojoProxy::FileExistsImpl(OpaqueDir* dir,
std::string name,
bool* exists) {
+ mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync;
filesystem::mojom::FileError error = filesystem::mojom::FileError::FAILED;
bool completed = dir->directory->Exists(name, &error, exists);
DCHECK(completed);
@@ -225,6 +229,7 @@ void LevelDBMojoProxy::GetChildrenImpl(
std::string name,
std::vector<std::string>* out_contents,
filesystem::mojom::FileError* out_error) {
+ mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync;
filesystem::mojom::DirectoryPtr target;
filesystem::mojom::DirectoryRequest proxy(&target);
bool completed = dir->directory->OpenDirectory(
@@ -250,6 +255,7 @@ void LevelDBMojoProxy::DeleteImpl(OpaqueDir* dir,
std::string name,
uint32_t delete_flags,
filesystem::mojom::FileError* out_error) {
+ mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync;
bool completed = dir->directory->Delete(name, delete_flags, out_error);
DCHECK(completed);
}
@@ -257,6 +263,7 @@ void LevelDBMojoProxy::DeleteImpl(OpaqueDir* dir,
void LevelDBMojoProxy::CreateDirImpl(OpaqueDir* dir,
std::string name,
filesystem::mojom::FileError* out_error) {
+ mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync;
bool completed = dir->directory->OpenDirectory(
name, nullptr,
filesystem::mojom::kFlagRead | filesystem::mojom::kFlagWrite |
@@ -270,6 +277,7 @@ void LevelDBMojoProxy::GetFileSizeImpl(
const std::string& path,
uint64_t* file_size,
filesystem::mojom::FileError* out_error) {
+ mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync;
filesystem::mojom::FileInformationPtr info;
bool completed = dir->directory->StatFile(path, out_error, &info);
DCHECK(completed);
@@ -281,6 +289,7 @@ void LevelDBMojoProxy::RenameFileImpl(OpaqueDir* dir,
const std::string& old_path,
const std::string& new_path,
filesystem::mojom::FileError* out_error) {
+ mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync;
bool completed = dir->directory->Rename(old_path, new_path, out_error);
DCHECK(completed);
}
@@ -289,6 +298,7 @@ void LevelDBMojoProxy::LockFileImpl(OpaqueDir* dir,
const std::string& path,
filesystem::mojom::FileError* out_error,
OpaqueLock** out_lock) {
+ mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync;
// Since a lock is associated with a file descriptor, we need to open and
// have a persistent file on the other side of the connection.
filesystem::mojom::FilePtr target;
@@ -315,6 +325,7 @@ void LevelDBMojoProxy::LockFileImpl(OpaqueDir* dir,
void LevelDBMojoProxy::UnlockFileImpl(std::unique_ptr<OpaqueLock> lock,
filesystem::mojom::FileError* out_error) {
+ mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync;
lock->lock_file->Unlock(out_error);
}

Powered by Google App Engine
This is Rietveld 408576698