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

Unified Diff: trunk/src/chrome/browser/history/history_db_task.h

Issue 416543006: Revert 284958 "Make HistoryDBTask not refcounted, and ensure it'..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 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: trunk/src/chrome/browser/history/history_db_task.h
===================================================================
--- trunk/src/chrome/browser/history/history_db_task.h (revision 285001)
+++ trunk/src/chrome/browser/history/history_db_task.h (working copy)
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_HISTORY_HISTORY_DB_TASK_H_
#define CHROME_BROWSER_HISTORY_HISTORY_DB_TASK_H_
+#include "base/memory/ref_counted.h"
+
namespace history {
class HistoryBackend;
@@ -14,12 +16,9 @@
// thread. HistoryDBTask is scheduled using HistoryService::ScheduleDBTask.
// When HistoryBackend processes the task it invokes RunOnDBThread. Once the
// task completes and has not been canceled, DoneRunOnMainThread is invoked back
-// on the main thread, after which this object is destroyed, also on the
-// main thread.
-class HistoryDBTask {
+// on the main thread.
+class HistoryDBTask : public base::RefCountedThreadSafe<HistoryDBTask> {
public:
- virtual ~HistoryDBTask() {}
-
// Invoked on the database thread. The return value indicates whether the
// task is done. A return value of true signals the task is done and
// RunOnDBThread should NOT be invoked again. A return value of false
@@ -31,6 +30,11 @@
// only invoked if the request was not canceled and returned true from
// RunOnDBThread.
virtual void DoneRunOnMainThread() = 0;
+
+ protected:
+ friend class base::RefCountedThreadSafe<HistoryDBTask>;
+
+ virtual ~HistoryDBTask() {}
};
} // namespace history
« no previous file with comments | « trunk/src/chrome/browser/history/history_browsertest.cc ('k') | trunk/src/chrome/browser/history/history_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698