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

Unified Diff: components/history/core/browser/history_backend.h

Issue 2672753002: Refactor History's CommitLaterTask with CancelableCallback (Closed)
Patch Set: Minor comment change. 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/history/core/browser/history_backend.h
diff --git a/components/history/core/browser/history_backend.h b/components/history/core/browser/history_backend.h
index 6959994ab1ae814988b99a55bda09e7a17a89aaf..42b222f68dbab950834b2931eca157ff112ced4e 100644
--- a/components/history/core/browser/history_backend.h
+++ b/components/history/core/browser/history_backend.h
@@ -14,12 +14,14 @@
#include <utility>
#include <vector>
+#include "base/cancelable_callback.h"
#include "base/containers/hash_tables.h"
#include "base/containers/mru_cache.h"
#include "base/files/file_path.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/memory_pressure_listener.h"
+#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/single_thread_task_runner.h"
#include "base/supports_user_data.h"
@@ -42,7 +44,6 @@ class SingleThreadTaskRunner;
}
namespace history {
-class CommitLaterTask;
struct DownloadRow;
class HistoryBackendClient;
class HistoryBackendDBBaseTest;
@@ -480,7 +481,6 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
private:
friend class base::RefCountedThreadSafe<HistoryBackend>;
- friend class CommitLaterTask; // The commit task needs to call Commit().
friend class HistoryBackendTest;
friend class HistoryBackendDBBaseTest; // So the unit tests can poke our
// innards.
@@ -828,10 +828,10 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
ExpireHistoryBackend expirer_;
// A commit has been scheduled to occur sometime in the future. We can check
- // non-null-ness to see if there is a commit scheduled in the future, and we
- // can use the pointer to cancel the scheduled commit. There can be only one
+ // !IsCancelled() to see if there is a commit scheduled in the future, and we
Marc Treib 2017/02/02 12:59:24 So IsCancelled()==true is the default state for an
+ // can use Cancel() to cancel the scheduled commit. There can be only one
// scheduled commit at a time (see ScheduleCommit).
- scoped_refptr<CommitLaterTask> scheduled_commit_;
+ base::CancelableClosure scheduled_commit_;
// Maps recent redirect destination pages to the chain of redirects that
// brought us to there. Pages that did not have redirects or were not the
@@ -890,6 +890,8 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
// List of observers
base::ObserverList<HistoryBackendObserver> observers_;
+ base::WeakPtrFactory<HistoryBackend> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(HistoryBackend);
};
« no previous file with comments | « no previous file | components/history/core/browser/history_backend.cc » ('j') | components/history/core/browser/history_backend.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698