summaryrefslogtreecommitdiffstats
path: root/sql
diff options
context:
space:
mode:
authordcheng <dcheng@chromium.org>2015-12-27 18:24:50 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-28 02:26:02 +0000
commite486004502c17ab80953ef324926a536b8030d1e (patch)
tree9f51129a18a65823dfa8242491756a0697ea274a /sql
parent03b487d118b5b1c0e5651a889cc56b443ba1d526 (diff)
downloadchromium_src-e486004502c17ab80953ef324926a536b8030d1e.zip
chromium_src-e486004502c17ab80953ef324926a536b8030d1e.tar.gz
chromium_src-e486004502c17ab80953ef324926a536b8030d1e.tar.bz2
Global conversion of Pass()→std::move() on OS==linux
❆(੭ु ◜◡‾)੭ु⁾☃❆ BUG=557422 R=avi@chromium.org TBR=jam@chromium.org Review URL: https://codereview.chromium.org/1550693002 Cr-Commit-Position: refs/heads/master@{#366956}
Diffstat (limited to 'sql')
-rw-r--r--sql/connection.cc9
-rw-r--r--sql/mojo/mojo_vfs.cc7
-rw-r--r--sql/mojo/sql_test_base.cc9
-rw-r--r--sql/mojo/vfs_unittest.cc6
-rw-r--r--sql/recovery.cc2
-rw-r--r--sql/recovery_unittest.cc33
6 files changed, 35 insertions, 31 deletions
diff --git a/sql/connection.cc b/sql/connection.cc
index 4d23f7d..9daa7d1 100644
--- a/sql/connection.cc
+++ b/sql/connection.cc
@@ -8,6 +8,7 @@
#include <stddef.h>
#include <stdint.h>
#include <string.h>
+#include <utility>
#include "base/bind.h"
#include "base/debug/dump_without_crashing.h"
@@ -695,9 +696,9 @@ bool Connection::RegisterIntentToUpload() const {
scoped_ptr<base::ListValue> dumps(new base::ListValue);
dumps->AppendString(histogram_tag_);
- root_dict->Set(kDiagnosticDumpsKey, dumps.Pass());
+ root_dict->Set(kDiagnosticDumpsKey, std::move(dumps));
- root = root_dict.Pass();
+ root = std::move(root_dict);
} else {
// Failure to read a valid dictionary implies that something is going wrong
// on the system.
@@ -707,7 +708,7 @@ bool Connection::RegisterIntentToUpload() const {
if (!read_root.get())
return false;
scoped_ptr<base::DictionaryValue> root_dict =
- base::DictionaryValue::From(read_root.Pass());
+ base::DictionaryValue::From(std::move(read_root));
if (!root_dict)
return false;
@@ -731,7 +732,7 @@ bool Connection::RegisterIntentToUpload() const {
// Record intention to proceed with upload.
dumps->AppendString(histogram_tag_);
- root = root_dict.Pass();
+ root = std::move(root_dict);
}
const base::FilePath breadcrumb_new =
diff --git a/sql/mojo/mojo_vfs.cc b/sql/mojo/mojo_vfs.cc
index 0fc2b48..5c427fb 100644
--- a/sql/mojo/mojo_vfs.cc
+++ b/sql/mojo/mojo_vfs.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <utility>
#include "base/logging.h"
#include "base/rand_util.h"
@@ -116,7 +117,7 @@ int MojoVFSWrite(sqlite3_file* sql_file,
filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
uint32_t num_bytes_written = 0;
- GetFSFile(sql_file)->Write(mojo_data.Pass(), offset,
+ GetFSFile(sql_file)->Write(std::move(mojo_data), offset,
filesystem::WHENCE_FROM_BEGIN,
Capture(&error, &num_bytes_written));
GetFSFile(sql_file).WaitForIncomingResponse();
@@ -299,7 +300,7 @@ int MojoVFSOpen(sqlite3_vfs* mojo_vfs,
// |file| is actually a malloced buffer of size szOsFile. This means that we
// need to manually use placement new to construct the C++ object which owns
// the pipe to our file.
- new (&GetFSFile(file)) filesystem::FilePtr(file_ptr.Pass());
+ new (&GetFSFile(file)) filesystem::FilePtr(std::move(file_ptr));
return SQLITE_OK;
}
@@ -431,7 +432,7 @@ static sqlite3_vfs mojo_vfs = {
ScopedMojoFilesystemVFS::ScopedMojoFilesystemVFS(
filesystem::DirectoryPtr root_directory)
: parent_(sqlite3_vfs_find(NULL)),
- root_directory_(root_directory.Pass()) {
+ root_directory_(std::move(root_directory)) {
CHECK(!mojo_vfs.pAppData);
mojo_vfs.pAppData = this;
mojo_vfs.mxPathname = parent_->mxPathname;
diff --git a/sql/mojo/sql_test_base.cc b/sql/mojo/sql_test_base.cc
index caa903a..1df6096 100644
--- a/sql/mojo/sql_test_base.cc
+++ b/sql/mojo/sql_test_base.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <utility>
#include "mojo/application/public/cpp/application_impl.h"
#include "mojo/util/capture_util.h"
@@ -79,7 +80,7 @@ bool SQLTestBase::CorruptSizeInHeaderOfDB() {
test::CorruptSizeInHeaderMemory(&header.front(), db_size);
uint32_t num_bytes_written = 0;
- file_ptr->Write(header.Pass(), 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)
@@ -112,7 +113,7 @@ void SQLTestBase::WriteJunkToDatabase(WriteJunkType type) {
memcpy(&data.front(), kJunk, strlen(kJunk));
uint32_t num_bytes_written = 0;
- file_ptr->Write(data.Pass(), 0, filesystem::WHENCE_FROM_BEGIN,
+ file_ptr->Write(std::move(data), 0, filesystem::WHENCE_FROM_BEGIN,
Capture(&error, &num_bytes_written));
file_ptr.WaitForIncomingResponse();
}
@@ -143,12 +144,12 @@ void SQLTestBase::SetUp() {
filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
filesystem::DirectoryPtr directory;
- files()->OpenFileSystem("temp", GetProxy(&directory), client.Pass(),
+ files()->OpenFileSystem("temp", GetProxy(&directory), std::move(client),
Capture(&error));
ASSERT_TRUE(files().WaitForIncomingResponse());
ASSERT_EQ(filesystem::FILE_ERROR_OK, error);
- vfs_.reset(new ScopedMojoFilesystemVFS(directory.Pass()));
+ 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 d6eee65..dc6a1ee 100644
--- a/sql/mojo/vfs_unittest.cc
+++ b/sql/mojo/vfs_unittest.cc
@@ -3,8 +3,8 @@
// found in the LICENSE file.
#include <stdint.h>
-
#include <memory>
+#include <utility>
#include "base/macros.h"
#include "components/filesystem/public/interfaces/file_system.mojom.h"
@@ -60,12 +60,12 @@ class VFSTest : public mojo::test::ApplicationTestBase,
filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
filesystem::DirectoryPtr directory;
- files_->OpenFileSystem("temp", GetProxy(&directory), client.Pass(),
+ files_->OpenFileSystem("temp", GetProxy(&directory), std::move(client),
mojo::Capture(&error));
ASSERT_TRUE(files_.WaitForIncomingResponse());
ASSERT_EQ(filesystem::FILE_ERROR_OK, error);
- vfs_.reset(new ScopedMojoFilesystemVFS(directory.Pass()));
+ vfs_.reset(new ScopedMojoFilesystemVFS(std::move(directory)));
}
void TearDown() override {
diff --git a/sql/recovery.cc b/sql/recovery.cc
index 7014433..377aafb 100644
--- a/sql/recovery.cc
+++ b/sql/recovery.cc
@@ -115,7 +115,7 @@ scoped_ptr<Recovery> Recovery::Begin(
return scoped_ptr<Recovery>();
}
- return r.Pass();
+ return r;
}
// static
diff --git a/sql/recovery_unittest.cc b/sql/recovery_unittest.cc
index 36c9de7..f964eb9 100644
--- a/sql/recovery_unittest.cc
+++ b/sql/recovery_unittest.cc
@@ -2,9 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <stddef.h>
+#include "sql/recovery.h"
+#include <stddef.h>
#include <string>
+#include <utility>
#include "base/bind.h"
#include "base/files/file_path.h"
@@ -14,7 +16,6 @@
#include "base/strings/string_number_conversions.h"
#include "sql/connection.h"
#include "sql/meta_table.h"
-#include "sql/recovery.h"
#include "sql/statement.h"
#include "sql/test/paths.h"
#include "sql/test/scoped_error_ignorer.h"
@@ -93,7 +94,7 @@ TEST_F(SQLRecoveryTest, RecoverBasic) {
{
scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
ASSERT_TRUE(recovery.get());
- sql::Recovery::Unrecoverable(recovery.Pass());
+ sql::Recovery::Unrecoverable(std::move(recovery));
// TODO(shess): Test that calls to recover.db() start failing.
}
@@ -120,7 +121,7 @@ TEST_F(SQLRecoveryTest, RecoverBasic) {
ASSERT_TRUE(recovery->db()->Execute(kAltInsertSql));
// Successfully recovered.
- ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
+ ASSERT_TRUE(sql::Recovery::Recovered(std::move(recovery)));
}
EXPECT_FALSE(db().is_open());
ASSERT_TRUE(Reopen());
@@ -163,7 +164,7 @@ TEST_F(SQLRecoveryTest, VirtualTable) {
ASSERT_TRUE(recovery->db()->Execute(kRecoveryCopySql));
// Successfully recovered.
- ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
+ ASSERT_TRUE(sql::Recovery::Recovered(std::move(recovery)));
}
// Since the database was not corrupt, the entire schema and all
@@ -204,7 +205,7 @@ void RecoveryCallback(sql::Connection* db, const base::FilePath& db_path,
ASSERT_TRUE(recovery->db()->Execute(kCreateIndex));
ASSERT_TRUE(recovery->db()->Execute(kRecoveryCopySql));
- ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
+ ASSERT_TRUE(sql::Recovery::Recovered(std::move(recovery)));
}
// Build a database, corrupt it by making an index reference to
@@ -361,7 +362,7 @@ TEST_F(SQLRecoveryTest, Meta) {
EXPECT_TRUE(recovery->GetMetaVersionNumber(&version));
EXPECT_EQ(kVersion, version);
- sql::Recovery::Rollback(recovery.Pass());
+ sql::Recovery::Rollback(std::move(recovery));
}
ASSERT_TRUE(Reopen()); // Handle was poisoned.
@@ -374,7 +375,7 @@ TEST_F(SQLRecoveryTest, Meta) {
EXPECT_FALSE(recovery->GetMetaVersionNumber(&version));
EXPECT_EQ(0, version);
- sql::Recovery::Rollback(recovery.Pass());
+ sql::Recovery::Rollback(std::move(recovery));
}
ASSERT_TRUE(Reopen()); // Handle was poisoned.
@@ -424,7 +425,7 @@ TEST_F(SQLRecoveryTest, AutoRecoverTable) {
EXPECT_EQ(temp_schema,
ExecuteWithResults(recovery->db(), kTempSchemaSql, "|", "\n"));
- ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
+ ASSERT_TRUE(sql::Recovery::Recovered(std::move(recovery)));
}
// Since the database was not corrupt, the entire schema and all
@@ -442,7 +443,7 @@ TEST_F(SQLRecoveryTest, AutoRecoverTable) {
size_t rows = 0;
EXPECT_FALSE(recovery->AutoRecoverTable("y", 0, &rows));
- sql::Recovery::Unrecoverable(recovery.Pass());
+ sql::Recovery::Unrecoverable(std::move(recovery));
}
}
@@ -500,7 +501,7 @@ TEST_F(SQLRecoveryTest, AutoRecoverTableWithDefault) {
EXPECT_TRUE(recovery->AutoRecoverTable("x", 0, &rows));
EXPECT_EQ(4u, rows);
- ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
+ ASSERT_TRUE(sql::Recovery::Recovered(std::move(recovery)));
}
// Since the database was not corrupt, the entire schema and all
@@ -536,7 +537,7 @@ TEST_F(SQLRecoveryTest, AutoRecoverTableNullFilter) {
EXPECT_TRUE(recovery->AutoRecoverTable("x", 0, &rows));
EXPECT_EQ(1u, rows);
- ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
+ ASSERT_TRUE(sql::Recovery::Recovered(std::move(recovery)));
}
// The schema should be the same, but only one row of data should
@@ -575,7 +576,7 @@ TEST_F(SQLRecoveryTest, AutoRecoverTableWithRowid) {
EXPECT_TRUE(recovery->AutoRecoverTable("x", 0, &rows));
EXPECT_EQ(2u, rows);
- ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
+ ASSERT_TRUE(sql::Recovery::Recovered(std::move(recovery)));
}
// Since the database was not corrupt, the entire schema and all
@@ -620,7 +621,7 @@ TEST_F(SQLRecoveryTest, AutoRecoverTableWithCompoundKey) {
EXPECT_TRUE(recovery->AutoRecoverTable("x", 0, &rows));
EXPECT_EQ(3u, rows);
- ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
+ ASSERT_TRUE(sql::Recovery::Recovered(std::move(recovery)));
}
// Since the database was not corrupt, the entire schema and all
@@ -654,7 +655,7 @@ TEST_F(SQLRecoveryTest, AutoRecoverTableExtendColumns) {
size_t rows = 0;
EXPECT_TRUE(recovery->AutoRecoverTable("x", 1, &rows));
EXPECT_EQ(2u, rows);
- ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
+ ASSERT_TRUE(sql::Recovery::Recovered(std::move(recovery)));
}
// Since the database was not corrupt, the entire schema and all
@@ -689,7 +690,7 @@ TEST_F(SQLRecoveryTest, Bug387868) {
EXPECT_EQ(43u, rows);
// Successfully recovered.
- EXPECT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
+ EXPECT_TRUE(sql::Recovery::Recovered(std::move(recovery)));
}
}
#endif // !defined(USE_SYSTEM_SQLITE)