summaryrefslogtreecommitdiffstats
path: root/sql
diff options
context:
space:
mode:
authorsammc <sammc@chromium.org>2016-01-20 21:30:18 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-21 05:31:02 +0000
commit16fb38a8b87fe700645055e472d84de7aefe48a5 (patch)
tree02d83267f9a8a9f8e182c6a857347a7a683e81e6 /sql
parentc8a1187b4dfc11061d8ba792c73225196c56c6aa (diff)
downloadchromium_src-16fb38a8b87fe700645055e472d84de7aefe48a5.zip
chromium_src-16fb38a8b87fe700645055e472d84de7aefe48a5.tar.gz
chromium_src-16fb38a8b87fe700645055e472d84de7aefe48a5.tar.bz2
Change mojo enums to be scoped enums in the generated C++ bindings.
Some mojo enums were previously not proper enums: they were constants for bitfields. These have been replaced by const int32s in the mojoms: - mus.mojom.EventFlags - mus.mojom.MouseEventFlags - mus.mojom.ResizeBehavior - mus.mojom.WindowTree.AccessPolicy Some mojo enum values now conflict with macros (mostly on Windows) and needed to change: - mus.mojom.Cursor.NULL became CURSOR_NULL (again) - mus.mojom.KeyboardCode.DELETE became DELETE_KEY - mus.mojom.WindowManagerErrorCode.ERROR_ACCESS_DENIED became ACCESS_DENIED - device.usb.TransferDirection.IN became INBOUND - device.usb.TransferDirection.OUT became OUTBOUND - device.usb.TransferStatus.ERROR became TRANSFER_ERROR - device.NFCRecordType.OPAQUE became OPAQUE_RECORD - media.interfaces.Decryptor.Status.ERROR became DECRYPTION_ERROR - skia.AlphaType.OPAQUE became ALPHA_TYPE_OPAQUE Review URL: https://codereview.chromium.org/1527183003 Cr-Commit-Position: refs/heads/master@{#370632}
Diffstat (limited to 'sql')
-rw-r--r--sql/mojo/mojo_vfs.cc38
-rw-r--r--sql/mojo/sql_test_base.cc34
-rw-r--r--sql/mojo/vfs_unittest.cc4
3 files changed, 38 insertions, 38 deletions
diff --git a/sql/mojo/mojo_vfs.cc b/sql/mojo/mojo_vfs.cc
index 5c427fb..bd962d0 100644
--- a/sql/mojo/mojo_vfs.cc
+++ b/sql/mojo/mojo_vfs.cc
@@ -67,7 +67,7 @@ int MojoVFSClose(sqlite3_file* file) {
DVLOG(1) << "MojoVFSClose(*)";
TRACE_EVENT0("sql", "MojoVFSClose");
using filesystem::FilePtr;
- filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
+ filesystem::FileError error = filesystem::FileError::FAILED;
// Must call File::Close explicitly instead of just deleting the file, since
// otherwise we wouldn't have an object to wait on.
GetFSFile(file)->Close(mojo::Capture(&error));
@@ -82,13 +82,13 @@ int MojoVFSRead(sqlite3_file* sql_file,
sqlite3_int64 offset) {
DVLOG(1) << "MojoVFSRead (" << size << " @ " << offset << ")";
TRACE_EVENT0("sql", "MojoVFSRead");
- filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
+ filesystem::FileError error = filesystem::FileError::FAILED;
mojo::Array<uint8_t> mojo_data;
- GetFSFile(sql_file)->Read(size, offset, filesystem::WHENCE_FROM_BEGIN,
+ GetFSFile(sql_file)->Read(size, offset, filesystem::Whence::FROM_BEGIN,
Capture(&error, &mojo_data));
GetFSFile(sql_file).WaitForIncomingResponse();
- if (error != filesystem::FILE_ERROR_OK) {
+ if (error != filesystem::FileError::OK) {
// TODO(erg): Better implementation here.
NOTIMPLEMENTED();
return SQLITE_IOERR_READ;
@@ -115,13 +115,13 @@ int MojoVFSWrite(sqlite3_file* sql_file,
mojo::Array<uint8_t> mojo_data(size);
memcpy(&mojo_data.front(), buffer, size);
- filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
+ filesystem::FileError error = filesystem::FileError::FAILED;
uint32_t num_bytes_written = 0;
GetFSFile(sql_file)->Write(std::move(mojo_data), offset,
- filesystem::WHENCE_FROM_BEGIN,
+ filesystem::Whence::FROM_BEGIN,
Capture(&error, &num_bytes_written));
GetFSFile(sql_file).WaitForIncomingResponse();
- if (error != filesystem::FILE_ERROR_OK) {
+ if (error != filesystem::FileError::OK) {
// TODO(erg): Better implementation here.
NOTIMPLEMENTED();
return SQLITE_IOERR_WRITE;
@@ -137,10 +137,10 @@ int MojoVFSWrite(sqlite3_file* sql_file,
int MojoVFSTruncate(sqlite3_file* sql_file, sqlite_int64 size) {
DVLOG(1) << "MojoVFSTruncate(*, " << size << ")";
TRACE_EVENT0("sql", "MojoVFSTruncate");
- filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
+ filesystem::FileError error = filesystem::FileError::FAILED;
GetFSFile(sql_file)->Truncate(size, Capture(&error));
GetFSFile(sql_file).WaitForIncomingResponse();
- if (error != filesystem::FILE_ERROR_OK) {
+ if (error != filesystem::FileError::OK) {
// TODO(erg): Better implementation here.
NOTIMPLEMENTED();
return SQLITE_IOERR_TRUNCATE;
@@ -152,10 +152,10 @@ int MojoVFSTruncate(sqlite3_file* sql_file, sqlite_int64 size) {
int MojoVFSSync(sqlite3_file* sql_file, int flags) {
DVLOG(1) << "MojoVFSSync(*, " << flags << ")";
TRACE_EVENT0("sql", "MojoVFSSync");
- filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
+ filesystem::FileError error = filesystem::FileError::FAILED;
GetFSFile(sql_file)->Flush(Capture(&error));
GetFSFile(sql_file).WaitForIncomingResponse();
- if (error != filesystem::FILE_ERROR_OK) {
+ if (error != filesystem::FileError::OK) {
// TODO(erg): Better implementation here.
NOTIMPLEMENTED();
return SQLITE_IOERR_FSYNC;
@@ -168,12 +168,12 @@ int MojoVFSFileSize(sqlite3_file* sql_file, sqlite_int64* size) {
DVLOG(1) << "MojoVFSFileSize(*)";
TRACE_EVENT0("sql", "MojoVFSFileSize");
- filesystem::FileError err = filesystem::FILE_ERROR_FAILED;
+ filesystem::FileError err = filesystem::FileError::FAILED;
filesystem::FileInformationPtr file_info;
GetFSFile(sql_file)->Stat(Capture(&err, &file_info));
GetFSFile(sql_file).WaitForIncomingResponse();
- if (err != filesystem::FILE_ERROR_OK) {
+ if (err != filesystem::FileError::OK) {
// TODO(erg): Better implementation here.
NOTIMPLEMENTED();
return SQLITE_IOERR_FSTAT;
@@ -283,11 +283,11 @@ int MojoVFSOpen(sqlite3_vfs* mojo_vfs,
// Grab the incoming file
filesystem::FilePtr file_ptr;
- filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
+ filesystem::FileError error = filesystem::FileError::FAILED;
GetRootDirectory(mojo_vfs)->OpenFile(mojo_name, GetProxy(&file_ptr),
open_flags, Capture(&error));
GetRootDirectory(mojo_vfs).WaitForIncomingResponse();
- if (error != filesystem::FILE_ERROR_OK) {
+ if (error != filesystem::FileError::OK) {
// TODO(erg): Translate more of the mojo error codes into sqlite error
// codes.
return SQLITE_CANTOPEN;
@@ -313,16 +313,16 @@ int MojoVFSDelete(sqlite3_vfs* mojo_vfs, const char* filename, int sync_dir) {
// TODO(erg): The default windows sqlite VFS has retry code to work around
// antivirus software keeping files open. We'll probably have to do something
// like that in the far future if we ever support Windows.
- filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
+ filesystem::FileError error = filesystem::FileError::FAILED;
GetRootDirectory(mojo_vfs)->Delete(filename, 0, Capture(&error));
GetRootDirectory(mojo_vfs).WaitForIncomingResponse();
- if (error == filesystem::FILE_ERROR_OK && sync_dir) {
+ if (error == filesystem::FileError::OK && sync_dir) {
GetRootDirectory(mojo_vfs)->Flush(Capture(&error));
GetRootDirectory(mojo_vfs).WaitForIncomingResponse();
}
- return error == filesystem::FILE_ERROR_OK ? SQLITE_OK : SQLITE_IOERR_DELETE;
+ return error == filesystem::FileError::OK ? SQLITE_OK : SQLITE_IOERR_DELETE;
}
int MojoVFSAccess(sqlite3_vfs* mojo_vfs,
@@ -333,7 +333,7 @@ int MojoVFSAccess(sqlite3_vfs* mojo_vfs,
TRACE_EVENT2("sql", "MojoVFSAccess",
"name", filename,
"flags", flags);
- filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
+ filesystem::FileError error = filesystem::FileError::FAILED;
if (flags == SQLITE_ACCESS_READWRITE || flags == SQLITE_ACCESS_READ) {
bool is_writable = false;
diff --git a/sql/mojo/sql_test_base.cc b/sql/mojo/sql_test_base.cc
index 72aaa64..a5e061d 100644
--- a/sql/mojo/sql_test_base.cc
+++ b/sql/mojo/sql_test_base.cc
@@ -38,11 +38,11 @@ bool SQLTestBase::Reopen() {
}
bool SQLTestBase::GetPathExists(const base::FilePath& path) {
- filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
+ filesystem::FileError error = filesystem::FileError::FAILED;
bool exists = false;
vfs_->GetDirectory()->Exists(path.AsUTF8Unsafe(), Capture(&error, &exists));
vfs_->GetDirectory().WaitForIncomingResponse();
- if (error != filesystem::FILE_ERROR_OK)
+ if (error != filesystem::FileError::OK)
return false;
return exists;
}
@@ -53,7 +53,7 @@ bool SQLTestBase::CorruptSizeInHeaderOfDB() {
mojo::Array<uint8_t> header;
- filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
+ filesystem::FileError error = filesystem::FileError::FAILED;
filesystem::FilePtr file_ptr;
vfs_->GetDirectory()->OpenFile(
mojo::String(db_path().AsUTF8Unsafe()), GetProxy(&file_ptr),
@@ -61,29 +61,29 @@ bool SQLTestBase::CorruptSizeInHeaderOfDB() {
filesystem::kFlagOpenAlways,
Capture(&error));
vfs_->GetDirectory().WaitForIncomingResponse();
- if (error != filesystem::FILE_ERROR_OK)
+ if (error != filesystem::FileError::OK)
return false;
- file_ptr->Read(kHeaderSize, 0, filesystem::WHENCE_FROM_BEGIN,
+ file_ptr->Read(kHeaderSize, 0, filesystem::Whence::FROM_BEGIN,
Capture(&error, &header));
file_ptr.WaitForIncomingResponse();
- if (error != filesystem::FILE_ERROR_OK)
+ if (error != filesystem::FileError::OK)
return false;
filesystem::FileInformationPtr info;
file_ptr->Stat(Capture(&error, &info));
file_ptr.WaitForIncomingResponse();
- if (error != filesystem::FILE_ERROR_OK)
+ if (error != filesystem::FileError::OK)
return false;
int64_t db_size = info->size;
test::CorruptSizeInHeaderMemory(&header.front(), db_size);
uint32_t num_bytes_written = 0;
- file_ptr->Write(std::move(header), 0, filesystem::WHENCE_FROM_BEGIN,
+ file_ptr->Write(std::move(header), 0, filesystem::Whence::FROM_BEGIN,
Capture(&error, &num_bytes_written));
file_ptr.WaitForIncomingResponse();
- if (error != filesystem::FILE_ERROR_OK)
+ if (error != filesystem::FileError::OK)
return false;
if (num_bytes_written != kHeaderSize)
return false;
@@ -98,14 +98,14 @@ void SQLTestBase::WriteJunkToDatabase(WriteJunkType type) {
else
flags = filesystem::kFlagWrite | filesystem::kFlagOpen;
- filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
+ filesystem::FileError error = filesystem::FileError::FAILED;
filesystem::FilePtr file_ptr;
vfs_->GetDirectory()->OpenFile(
mojo::String(db_path().AsUTF8Unsafe()), GetProxy(&file_ptr),
flags,
Capture(&error));
vfs_->GetDirectory().WaitForIncomingResponse();
- if (error != filesystem::FILE_ERROR_OK)
+ if (error != filesystem::FileError::OK)
return;
const char* kJunk = "Now is the winter of our discontent.";
@@ -113,25 +113,25 @@ void SQLTestBase::WriteJunkToDatabase(WriteJunkType type) {
memcpy(&data.front(), kJunk, strlen(kJunk));
uint32_t num_bytes_written = 0;
- file_ptr->Write(std::move(data), 0, filesystem::WHENCE_FROM_BEGIN,
+ file_ptr->Write(std::move(data), 0, filesystem::Whence::FROM_BEGIN,
Capture(&error, &num_bytes_written));
file_ptr.WaitForIncomingResponse();
}
void SQLTestBase::TruncateDatabase() {
- filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
+ filesystem::FileError error = filesystem::FileError::FAILED;
filesystem::FilePtr file_ptr;
vfs_->GetDirectory()->OpenFile(
mojo::String(db_path().AsUTF8Unsafe()), GetProxy(&file_ptr),
filesystem::kFlagWrite | filesystem::kFlagOpen,
Capture(&error));
vfs_->GetDirectory().WaitForIncomingResponse();
- if (error != filesystem::FILE_ERROR_OK)
+ if (error != filesystem::FileError::OK)
return;
file_ptr->Truncate(0, Capture(&error));
file_ptr.WaitForIncomingResponse();
- ASSERT_EQ(filesystem::FILE_ERROR_OK, error);
+ ASSERT_EQ(filesystem::FileError::OK, error);
}
void SQLTestBase::SetUp() {
@@ -142,12 +142,12 @@ void SQLTestBase::SetUp() {
filesystem::FileSystemClientPtr client;
binding_.Bind(GetProxy(&client));
- filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
+ filesystem::FileError error = filesystem::FileError::FAILED;
filesystem::DirectoryPtr directory;
files()->OpenFileSystem("temp", GetProxy(&directory), std::move(client),
Capture(&error));
ASSERT_TRUE(files().WaitForIncomingResponse());
- ASSERT_EQ(filesystem::FILE_ERROR_OK, error);
+ ASSERT_EQ(filesystem::FileError::OK, error);
vfs_.reset(new ScopedMojoFilesystemVFS(std::move(directory)));
ASSERT_TRUE(db_.Open(db_path()));
diff --git a/sql/mojo/vfs_unittest.cc b/sql/mojo/vfs_unittest.cc
index e51f1bd..e53ea11 100644
--- a/sql/mojo/vfs_unittest.cc
+++ b/sql/mojo/vfs_unittest.cc
@@ -58,12 +58,12 @@ class VFSTest : public mojo::test::ApplicationTestBase,
filesystem::FileSystemClientPtr client;
binding_.Bind(GetProxy(&client));
- filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
+ filesystem::FileError error = filesystem::FileError::FAILED;
filesystem::DirectoryPtr directory;
files_->OpenFileSystem("temp", GetProxy(&directory), std::move(client),
mojo::Capture(&error));
ASSERT_TRUE(files_.WaitForIncomingResponse());
- ASSERT_EQ(filesystem::FILE_ERROR_OK, error);
+ ASSERT_EQ(filesystem::FileError::OK, error);
vfs_.reset(new ScopedMojoFilesystemVFS(std::move(directory)));
}