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

Unified Diff: chrome/browser/history/history.cc

Issue 198011: Enable database logging on history thread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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
« no previous file with comments | « base/thread.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/history.cc
===================================================================
--- chrome/browser/history/history.cc (revision 25477)
+++ chrome/browser/history/history.cc (working copy)
@@ -40,6 +40,7 @@
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/history/in_memory_database.h"
#include "chrome/browser/history/in_memory_history_backend.h"
+#include "chrome/browser/history/visit_log.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/visitedlink_master.h"
#include "chrome/common/chrome_constants.h"
@@ -53,8 +54,27 @@
using base::Time;
using history::HistoryBackend;
-static const char* kHistoryThreadName = "Chrome_HistoryThread";
+namespace {
+class ChromeHistoryThread : public ChromeThread {
+ public:
+ ChromeHistoryThread() : ChromeThread(ChromeThread::HISTORY) {}
+ virtual ~ChromeHistoryThread() {
+ // We cannot rely on our base class to call Stop() in case we want our
+ // CleanUp function to run.
+ Stop();
+ }
+ protected:
+ virtual void Run(MessageLoop* message_loop) {
+ // Allocate VisitLog on local stack so it will be saved in crash dump.
+ history::VisitLog visit_log;
+ history::InitVisitLog(&visit_log);
+ message_loop->Run();
+ }
+};
+
+} // namespace
+
// Sends messages from the backend to us on the main thread. This must be a
// separate class from the history service so that it can hold a reference to
// the history service (otherwise we would have to manually AddRef and
@@ -100,7 +120,7 @@
const history::StarID HistoryService::kBookmarkBarID = 1;
HistoryService::HistoryService()
- : thread_(new base::Thread(kHistoryThreadName)),
+ : thread_(new ChromeHistoryThread()),
profile_(NULL),
backend_loaded_(false) {
// Is NULL when running generate_profile.
@@ -111,7 +131,7 @@
}
HistoryService::HistoryService(Profile* profile)
- : thread_(new base::Thread(kHistoryThreadName)),
+ : thread_(new ChromeHistoryThread()),
profile_(profile),
backend_loaded_(false) {
registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED,
« no previous file with comments | « base/thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698