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

Unified Diff: net/extras/sqlite/sqlite_persistent_cookie_store.cc

Issue 2937963003: Shift cookie system callbacks to OnceCallback to impedance match mojo. (Closed)
Patch Set: Finish Merge Created 3 years, 6 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: net/extras/sqlite/sqlite_persistent_cookie_store.cc
diff --git a/net/extras/sqlite/sqlite_persistent_cookie_store.cc b/net/extras/sqlite/sqlite_persistent_cookie_store.cc
index 9d93a645233e29b331d53c1cda4ea6ecbc40f2d8..5b6f2abfbc7915db253bf3a774410dc4e0b640d6 100644
--- a/net/extras/sqlite/sqlite_persistent_cookie_store.cc
+++ b/net/extras/sqlite/sqlite_persistent_cookie_store.cc
@@ -124,7 +124,7 @@ class SQLitePersistentCookieStore::Backend
void DeleteCookie(const CanonicalCookie& cc);
// Commit pending operations as soon as possible.
- void Flush(const base::Closure& callback);
+ void Flush(base::OnceClosure callback);
// Commit any pending operations and close the database. This must be called
// before the object is destructed.
@@ -182,7 +182,7 @@ class SQLitePersistentCookieStore::Backend
// Flushes (Commits) pending operations on the background runner, and invokes
// |callback| on the client thread when done.
- void FlushAndNotifyInBackground(const base::Closure& callback);
+ void FlushAndNotifyInBackground(base::OnceClosure callback);
// Sends notification when the entire store is loaded, and reports metrics
// for the total time to load and aggregated results from any priority loads
@@ -231,9 +231,9 @@ class SQLitePersistentCookieStore::Backend
void KillDatabase();
void PostBackgroundTask(const tracked_objects::Location& origin,
- const base::Closure& task);
+ base::OnceClosure task);
void PostClientTask(const tracked_objects::Location& origin,
- const base::Closure& task);
+ base::OnceClosure task);
// Shared code between the different load strategies to be used after all
// cookies have been loaded.
@@ -546,10 +546,10 @@ void SQLitePersistentCookieStore::Backend::LoadKeyAndNotifyInBackground(
}
void SQLitePersistentCookieStore::Backend::FlushAndNotifyInBackground(
- const base::Closure& callback) {
+ base::OnceClosure callback) {
Commit();
if (!callback.is_null())
- PostClientTask(FROM_HERE, callback);
+ PostClientTask(FROM_HERE, std::move(callback));
}
void SQLitePersistentCookieStore::Backend::CompleteLoadForKeyInForeground(
@@ -1201,11 +1201,11 @@ void SQLitePersistentCookieStore::Backend::Commit() {
succeeded ? 0 : 1, 2);
}
-void SQLitePersistentCookieStore::Backend::Flush(
- const base::Closure& callback) {
+void SQLitePersistentCookieStore::Backend::Flush(base::OnceClosure callback) {
DCHECK(!background_task_runner_->RunsTasksInCurrentSequence());
- PostBackgroundTask(FROM_HERE, base::Bind(&Backend::FlushAndNotifyInBackground,
- this, callback));
+ PostBackgroundTask(FROM_HERE,
+ base::BindOnce(&Backend::FlushAndNotifyInBackground, this,
+ std::move(callback)));
}
// Fire off a close message to the background runner. We could still have a
@@ -1342,8 +1342,8 @@ void SQLitePersistentCookieStore::Backend::BackgroundDeleteAllInList(
void SQLitePersistentCookieStore::Backend::PostBackgroundTask(
const tracked_objects::Location& origin,
- const base::Closure& task) {
- if (!background_task_runner_->PostTask(origin, task)) {
+ base::OnceClosure task) {
+ if (!background_task_runner_->PostTask(origin, std::move(task))) {
LOG(WARNING) << "Failed to post task from " << origin.ToString()
<< " to background_task_runner_.";
}
@@ -1351,8 +1351,8 @@ void SQLitePersistentCookieStore::Backend::PostBackgroundTask(
void SQLitePersistentCookieStore::Backend::PostClientTask(
const tracked_objects::Location& origin,
- const base::Closure& task) {
- if (!client_task_runner_->PostTask(origin, task)) {
+ base::OnceClosure task) {
+ if (!client_task_runner_->PostTask(origin, std::move(task))) {
LOG(WARNING) << "Failed to post task from " << origin.ToString()
<< " to client_task_runner_.";
}
@@ -1433,9 +1433,9 @@ void SQLitePersistentCookieStore::SetForceKeepSessionState() {
// This store never discards session-only cookies, so this call has no effect.
}
-void SQLitePersistentCookieStore::Flush(const base::Closure& callback) {
+void SQLitePersistentCookieStore::Flush(base::OnceClosure callback) {
if (backend_)
- backend_->Flush(callback);
+ backend_->Flush(std::move(callback));
}
SQLitePersistentCookieStore::~SQLitePersistentCookieStore() {
« net/cookies/cookie_monster.cc ('K') | « net/extras/sqlite/sqlite_persistent_cookie_store.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698