summaryrefslogtreecommitdiffstats
path: root/components/history
diff options
context:
space:
mode:
authordcheng <dcheng@chromium.org>2015-12-26 13:16:23 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-26 21:17:11 +0000
commit51606358c63e4005e53c8894463029b57d16751c (patch)
tree9097a0481effe003a1f5d7df7ba66f21b10c3d4e /components/history
parentf63a125013805bf3dd72f90ec33f4d0aa0606660 (diff)
downloadchromium_src-51606358c63e4005e53c8894463029b57d16751c.zip
chromium_src-51606358c63e4005e53c8894463029b57d16751c.tar.gz
chromium_src-51606358c63e4005e53c8894463029b57d16751c.tar.bz2
Convert Pass()→std::move() in //components/[a-m]*
BUG=557422 R=avi@chromium.org TBR=jochen@chromium.org Review URL: https://codereview.chromium.org/1548193002 Cr-Commit-Position: refs/heads/master@{#366906}
Diffstat (limited to 'components/history')
-rw-r--r--components/history/content/browser/content_visit_delegate.cc4
-rw-r--r--components/history/core/browser/delete_directive_handler.cc3
-rw-r--r--components/history/core/browser/history_backend.cc14
-rw-r--r--components/history/core/browser/history_backend_unittest.cc2
-rw-r--r--components/history/core/browser/history_model_worker.cc4
-rw-r--r--components/history/core/browser/history_service.cc11
-rw-r--r--components/history/core/browser/thumbnail_database.cc20
-rw-r--r--components/history/core/browser/thumbnail_database_unittest.cc2
-rw-r--r--components/history/core/browser/top_sites_database.cc15
-rw-r--r--components/history/core/browser/top_sites_impl.cc4
-rw-r--r--components/history/core/browser/typed_url_syncable_service.cc5
-rw-r--r--components/history/core/browser/web_history_service.cc4
12 files changed, 49 insertions, 39 deletions
diff --git a/components/history/content/browser/content_visit_delegate.cc b/components/history/content/browser/content_visit_delegate.cc
index cb8ba50..b6137ea 100644
--- a/components/history/content/browser/content_visit_delegate.cc
+++ b/components/history/content/browser/content_visit_delegate.cc
@@ -4,6 +4,8 @@
#include "components/history/content/browser/content_visit_delegate.h"
+#include <utility>
+
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
@@ -118,7 +120,7 @@ void ContentVisitDelegate::RebuildTable(
const scoped_refptr<URLEnumerator>& enumerator) {
DCHECK(history_service_);
scoped_ptr<HistoryDBTask> task(new IterateUrlsDBTask(enumerator));
- history_service_->ScheduleDBTask(task.Pass(), &task_tracker_);
+ history_service_->ScheduleDBTask(std::move(task), &task_tracker_);
}
} // namespace history
diff --git a/components/history/core/browser/delete_directive_handler.cc b/components/history/core/browser/delete_directive_handler.cc
index cfd4f47..eadf1a6 100644
--- a/components/history/core/browser/delete_directive_handler.cc
+++ b/components/history/core/browser/delete_directive_handler.cc
@@ -5,6 +5,7 @@
#include "components/history/core/browser/delete_directive_handler.h"
#include <stddef.h>
+#include <utility>
#include "base/json/json_writer.h"
#include "base/rand_util.h"
@@ -296,7 +297,7 @@ void DeleteDirectiveHandler::Start(
const syncer::SyncDataList& initial_sync_data,
scoped_ptr<syncer::SyncChangeProcessor> sync_processor) {
DCHECK(thread_checker_.CalledOnValidThread());
- sync_processor_ = sync_processor.Pass();
+ sync_processor_ = std::move(sync_processor);
if (!initial_sync_data.empty()) {
// Drop processed delete directives during startup.
history_service->ScheduleDBTask(
diff --git a/components/history/core/browser/history_backend.cc b/components/history/core/browser/history_backend.cc
index b77dc55..bfbbf2c8 100644
--- a/components/history/core/browser/history_backend.cc
+++ b/components/history/core/browser/history_backend.cc
@@ -9,6 +9,7 @@
#include <list>
#include <map>
#include <set>
+#include <utility>
#include <vector>
#include "base/bind.h"
@@ -152,7 +153,9 @@ QueuedHistoryDBTask::QueuedHistoryDBTask(
scoped_ptr<HistoryDBTask> task,
scoped_refptr<base::SingleThreadTaskRunner> origin_loop,
const base::CancelableTaskTracker::IsCanceledCallback& is_canceled)
- : task_(task.Pass()), origin_loop_(origin_loop), is_canceled_(is_canceled) {
+ : task_(std::move(task)),
+ origin_loop_(origin_loop),
+ is_canceled_(is_canceled) {
DCHECK(task_);
DCHECK(origin_loop_);
DCHECK(!is_canceled_.is_null());
@@ -208,9 +211,8 @@ HistoryBackend::HistoryBackend(
recent_redirects_(kMaxRedirectCount),
backend_destroy_message_loop_(nullptr),
segment_queried_(false),
- backend_client_(backend_client.Pass()),
- task_runner_(task_runner) {
-}
+ backend_client_(std::move(backend_client)),
+ task_runner_(task_runner) {}
HistoryBackend::~HistoryBackend() {
DCHECK(!scheduled_commit_) << "Deleting without cleanup";
@@ -680,7 +682,7 @@ void HistoryBackend::InitImpl(
{
scoped_ptr<InMemoryHistoryBackend> mem_backend(new InMemoryHistoryBackend);
if (mem_backend->Init(history_name))
- delegate_->SetInMemoryBackend(mem_backend.Pass());
+ delegate_->SetInMemoryBackend(std::move(mem_backend));
}
db_->BeginExclusiveMode(); // Must be after the mem backend read the data.
@@ -2536,7 +2538,7 @@ void HistoryBackend::ProcessDBTask(
const base::CancelableTaskTracker::IsCanceledCallback& is_canceled) {
bool scheduled = !queued_history_db_tasks_.empty();
queued_history_db_tasks_.push_back(
- new QueuedHistoryDBTask(task.Pass(), origin_loop, is_canceled));
+ new QueuedHistoryDBTask(std::move(task), origin_loop, is_canceled));
if (!scheduled)
ProcessDBTaskImpl();
}
diff --git a/components/history/core/browser/history_backend_unittest.cc b/components/history/core/browser/history_backend_unittest.cc
index aad2fc5..13bcad8 100644
--- a/components/history/core/browser/history_backend_unittest.cc
+++ b/components/history/core/browser/history_backend_unittest.cc
@@ -291,7 +291,7 @@ class HistoryBackendTestBase : public testing::Test {
void HistoryBackendTestDelegate::SetInMemoryBackend(
scoped_ptr<InMemoryHistoryBackend> backend) {
- test_->SetInMemoryBackend(backend.Pass());
+ test_->SetInMemoryBackend(std::move(backend));
}
void HistoryBackendTestDelegate::NotifyFaviconsChanged(
diff --git a/components/history/core/browser/history_model_worker.cc b/components/history/core/browser/history_model_worker.cc
index 76f4200..ac819ff 100644
--- a/components/history/core/browser/history_model_worker.cc
+++ b/components/history/core/browser/history_model_worker.cc
@@ -4,6 +4,8 @@
#include "components/history/core/browser/history_model_worker.h"
+#include <utility>
+
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
#include "base/synchronization/waitable_event.h"
@@ -70,7 +72,7 @@ void PostWorkerTask(
syncer::SyncerError* error) {
if (history_service.get()) {
scoped_ptr<history::HistoryDBTask> task(new WorkerTask(work, done, error));
- history_service->ScheduleDBTask(task.Pass(), cancelable_tracker);
+ history_service->ScheduleDBTask(std::move(task), cancelable_tracker);
} else {
*error = syncer::CANNOT_DO_WORK;
done->Signal();
diff --git a/components/history/core/browser/history_service.cc b/components/history/core/browser/history_service.cc
index 6b4651d..288c011 100644
--- a/components/history/core/browser/history_service.cc
+++ b/components/history/core/browser/history_service.cc
@@ -18,6 +18,8 @@
#include "components/history/core/browser/history_service.h"
+#include <utility>
+
#include "base/bind_helpers.h"
#include "base/callback.h"
#include "base/command_line.h"
@@ -191,11 +193,10 @@ HistoryService::HistoryService()
HistoryService::HistoryService(scoped_ptr<HistoryClient> history_client,
scoped_ptr<VisitDelegate> visit_delegate)
: thread_(new base::Thread(kHistoryThreadName)),
- history_client_(history_client.Pass()),
- visit_delegate_(visit_delegate.Pass()),
+ history_client_(std::move(history_client)),
+ visit_delegate_(std::move(visit_delegate)),
backend_loaded_(false),
- weak_ptr_factory_(this) {
-}
+ weak_ptr_factory_(this) {}
HistoryService::~HistoryService() {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -967,7 +968,7 @@ syncer::SyncMergeResult HistoryService::MergeDataAndStartSyncing(
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK_EQ(type, syncer::HISTORY_DELETE_DIRECTIVES);
delete_directive_handler_.Start(this, initial_sync_data,
- sync_processor.Pass());
+ std::move(sync_processor));
return syncer::SyncMergeResult(type);
}
diff --git a/components/history/core/browser/thumbnail_database.cc b/components/history/core/browser/thumbnail_database.cc
index fb891b76..c295bb4 100644
--- a/components/history/core/browser/thumbnail_database.cc
+++ b/components/history/core/browser/thumbnail_database.cc
@@ -6,9 +6,9 @@
#include <stddef.h>
#include <stdint.h>
-
#include <algorithm>
#include <string>
+#include <utility>
#include "base/bind.h"
#include "base/debug/alias.h"
@@ -302,7 +302,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) {
// creating the recover virtual table for corrupt.meta. The table
// may not exist, or the database may be too far gone. Either
// way, unclear how to resolve.
- sql::Recovery::Rollback(recovery.Pass());
+ sql::Recovery::Rollback(std::move(recovery));
RecordRecoveryEvent(RECOVERY_EVENT_FAILED_META_VERSION);
return;
}
@@ -314,14 +314,14 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) {
// the code simple. http://crbug.com/327485 for numbers.
DCHECK_LE(kDeprecatedVersionNumber, 6);
if (version <= 6) {
- sql::Recovery::Unrecoverable(recovery.Pass());
+ sql::Recovery::Unrecoverable(std::move(recovery));
RecordRecoveryEvent(RECOVERY_EVENT_DEPRECATED);
return;
}
// Earlier versions have been handled or deprecated.
if (version < 7) {
- sql::Recovery::Unrecoverable(recovery.Pass());
+ sql::Recovery::Unrecoverable(std::move(recovery));
RecordRecoveryEvent(RECOVERY_EVENT_FAILED_META_WRONG_VERSION);
return;
}
@@ -330,7 +330,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) {
sql::MetaTable recover_meta_table;
if (!recover_meta_table.Init(recovery->db(), kCurrentVersionNumber,
kCompatibleVersionNumber)) {
- sql::Recovery::Rollback(recovery.Pass());
+ sql::Recovery::Rollback(std::move(recovery));
RecordRecoveryEvent(RECOVERY_EVENT_FAILED_META_INIT);
return;
}
@@ -347,25 +347,25 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) {
// could be opened as in-memory. If the temp database had a
// filesystem problem and the temp filesystem differs from the
// main database, then that could fix it.
- sql::Recovery::Rollback(recovery.Pass());
+ sql::Recovery::Rollback(std::move(recovery));
RecordRecoveryEvent(RECOVERY_EVENT_FAILED_INIT);
return;
}
if (!recovery->AutoRecoverTable("favicons", 0, &favicons_rows_recovered)) {
- sql::Recovery::Rollback(recovery.Pass());
+ sql::Recovery::Rollback(std::move(recovery));
RecordRecoveryEvent(RECOVERY_EVENT_FAILED_AUTORECOVER_FAVICONS);
return;
}
if (!recovery->AutoRecoverTable("favicon_bitmaps", 0,
&favicon_bitmaps_rows_recovered)) {
- sql::Recovery::Rollback(recovery.Pass());
+ sql::Recovery::Rollback(std::move(recovery));
RecordRecoveryEvent(RECOVERY_EVENT_FAILED_AUTORECOVER_FAVICON_BITMAPS);
return;
}
if (!recovery->AutoRecoverTable("icon_mapping", 0,
&icon_mapping_rows_recovered)) {
- sql::Recovery::Rollback(recovery.Pass());
+ sql::Recovery::Rollback(std::move(recovery));
RecordRecoveryEvent(RECOVERY_EVENT_FAILED_AUTORECOVER_ICON_MAPPING);
return;
}
@@ -380,7 +380,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) {
// and sequence the statements, as it is basically a form of garbage
// collection.
- if (!sql::Recovery::Recovered(recovery.Pass())) {
+ if (!sql::Recovery::Recovered(std::move(recovery))) {
RecordRecoveryEvent(RECOVERY_EVENT_FAILED_COMMIT);
return;
}
diff --git a/components/history/core/browser/thumbnail_database_unittest.cc b/components/history/core/browser/thumbnail_database_unittest.cc
index 8c71f0e..4f6b7c3 100644
--- a/components/history/core/browser/thumbnail_database_unittest.cc
+++ b/components/history/core/browser/thumbnail_database_unittest.cc
@@ -166,7 +166,7 @@ class ThumbnailDatabaseTest : public testing::Test {
EXPECT_EQ(sql::INIT_OK, db->Init(file_name_));
db->BeginTransaction();
- return db.Pass();
+ return db;
}
protected:
diff --git a/components/history/core/browser/top_sites_database.cc b/components/history/core/browser/top_sites_database.cc
index 3ebccb9..faa61fc 100644
--- a/components/history/core/browser/top_sites_database.cc
+++ b/components/history/core/browser/top_sites_database.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <utility>
#include "base/files/file_util.h"
#include "base/memory/ref_counted.h"
@@ -228,7 +229,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) {
// TODO(shess): Prior histograms indicate all failures are in creating the
// recover virtual table for corrupt.meta. The table may not exist, or the
// database may be too far gone. Either way, unclear how to resolve.
- sql::Recovery::Rollback(recovery.Pass());
+ sql::Recovery::Rollback(std::move(recovery));
RecordRecoveryEvent(RECOVERY_EVENT_FAILED_META_VERSION);
return;
}
@@ -237,7 +238,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) {
// that the regular deprecation path cannot. The effect of this code will be
// to raze the database.
if (version <= kDeprecatedVersionNumber) {
- sql::Recovery::Unrecoverable(recovery.Pass());
+ sql::Recovery::Unrecoverable(std::move(recovery));
RecordRecoveryEvent(RECOVERY_EVENT_DEPRECATED);
return;
}
@@ -247,7 +248,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) {
// infrequent enough.
if (version != 2 && version != 3) {
RecordRecoveryEvent(RECOVERY_EVENT_FAILED_META_WRONG_VERSION);
- sql::Recovery::Rollback(recovery.Pass());
+ sql::Recovery::Rollback(std::move(recovery));
return;
}
@@ -255,7 +256,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) {
sql::MetaTable recover_meta_table;
if (!recover_meta_table.Init(recovery->db(), kVersionNumber,
kVersionNumber)) {
- sql::Recovery::Rollback(recovery.Pass());
+ sql::Recovery::Rollback(std::move(recovery));
RecordRecoveryEvent(RECOVERY_EVENT_FAILED_META_INIT);
return;
}
@@ -271,7 +272,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) {
// opened as in-memory. If the temp database had a filesystem problem and
// the temp filesystem differs from the main database, then that could fix
// it.
- sql::Recovery::Rollback(recovery.Pass());
+ sql::Recovery::Rollback(std::move(recovery));
RecordRecoveryEvent(RECOVERY_EVENT_FAILED_SCHEMA_INIT);
return;
}
@@ -279,7 +280,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) {
// The |1| is because v2 [thumbnails] has one less column than v3 did. In the
// v2 case the column will get default values.
if (!recovery->AutoRecoverTable("thumbnails", 1, &thumbnails_recovered)) {
- sql::Recovery::Rollback(recovery.Pass());
+ sql::Recovery::Rollback(std::move(recovery));
RecordRecoveryEvent(RECOVERY_EVENT_FAILED_AUTORECOVER_THUMBNAILS);
return;
}
@@ -287,7 +288,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) {
// TODO(shess): Inline this?
FixThumbnailsTable(recovery->db());
- if (!sql::Recovery::Recovered(recovery.Pass())) {
+ if (!sql::Recovery::Recovered(std::move(recovery))) {
// TODO(shess): Very unclear what this failure would actually mean, and what
// should be done. Add histograms to Recovered() implementation to get some
// insight.
diff --git a/components/history/core/browser/top_sites_impl.cc b/components/history/core/browser/top_sites_impl.cc
index a0233a4..9e3391e 100644
--- a/components/history/core/browser/top_sites_impl.cc
+++ b/components/history/core/browser/top_sites_impl.cc
@@ -5,9 +5,9 @@
#include "components/history/core/browser/top_sites_impl.h"
#include <stdint.h>
-
#include <algorithm>
#include <set>
+#include <utility>
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -334,7 +334,7 @@ void TopSitesImpl::AddBlacklistedURL(const GURL& url) {
{
DictionaryPrefUpdate update(pref_service_, kMostVisitedURLsBlacklist);
base::DictionaryValue* blacklist = update.Get();
- blacklist->SetWithoutPathExpansion(GetURLHash(url), dummy.Pass());
+ blacklist->SetWithoutPathExpansion(GetURLHash(url), std::move(dummy));
}
ResetThreadSafeCache();
diff --git a/components/history/core/browser/typed_url_syncable_service.cc b/components/history/core/browser/typed_url_syncable_service.cc
index ffe3fe2..820f30a 100644
--- a/components/history/core/browser/typed_url_syncable_service.cc
+++ b/components/history/core/browser/typed_url_syncable_service.cc
@@ -5,6 +5,7 @@
#include "components/history/core/browser/typed_url_syncable_service.h"
#include <stddef.h>
+#include <utility>
#include "base/auto_reset.h"
#include "base/logging.h"
@@ -87,8 +88,8 @@ syncer::SyncMergeResult TypedUrlSyncableService::MergeDataAndStartSyncing(
DCHECK_EQ(type, syncer::TYPED_URLS);
syncer::SyncMergeResult merge_result(type);
- sync_processor_ = sync_processor.Pass();
- sync_error_handler_ = error_handler.Pass();
+ sync_processor_ = std::move(sync_processor);
+ sync_error_handler_ = std::move(error_handler);
ClearErrorStats();
diff --git a/components/history/core/browser/web_history_service.cc b/components/history/core/browser/web_history_service.cc
index b830faf..392db72 100644
--- a/components/history/core/browser/web_history_service.cc
+++ b/components/history/core/browser/web_history_service.cc
@@ -319,7 +319,7 @@ scoped_ptr<base::DictionaryValue> WebHistoryService::ReadResponse(
else
DLOG(WARNING) << "Non-JSON response received from history server.";
}
- return result.Pass();
+ return result;
}
scoped_ptr<WebHistoryService::Request> WebHistoryService::QueryHistory(
@@ -333,7 +333,7 @@ scoped_ptr<WebHistoryService::Request> WebHistoryService::QueryHistory(
GURL url = GetQueryUrl(text_query, options, server_version_info_);
scoped_ptr<Request> request(CreateRequest(url, completion_callback));
request->Start();
- return request.Pass();
+ return request;
}
void WebHistoryService::ExpireHistory(