summaryrefslogtreecommitdiffstats
path: root/chrome/browser/history
diff options
context:
space:
mode:
authorhuanr@chromium.org <huanr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-10 05:00:20 +0000
committerhuanr@chromium.org <huanr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-10 05:00:20 +0000
commit828bd79b15617c803e4918d131dd568159f5ac97 (patch)
treea6ed4b365f039715fc56b3d18b906c74c26036a6 /chrome/browser/history
parent3d96893747d18a3c1bf06084d4605a4b34af732f (diff)
downloadchromium_src-828bd79b15617c803e4918d131dd568159f5ac97.zip
chromium_src-828bd79b15617c803e4918d131dd568159f5ac97.tar.gz
chromium_src-828bd79b15617c803e4918d131dd568159f5ac97.tar.bz2
Retry 25770 after fixing Valgrind issue.
Enable database logging on history thread. Original review: http://codereview.chromium.org/198011 BUG=16591 TEST=History UI test Review URL: http://codereview.chromium.org/194067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25842 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r--chrome/browser/history/history.cc30
-rw-r--r--chrome/browser/history/visit_log.cc5
-rw-r--r--chrome/browser/history/visit_log.h1
3 files changed, 33 insertions, 3 deletions
diff --git a/chrome/browser/history/history.cc b/chrome/browser/history/history.cc
index 8310c23..7b18da4 100644
--- a/chrome/browser/history/history.cc
+++ b/chrome/browser/history/history.cc
@@ -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,7 +54,30 @@
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() since we want our
+ // CleanUp function to run.
+ Stop();
+ }
+ protected:
+ virtual void CleanUp() {
+ history::ClearVisitLog();
+ }
+ 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();
+ history::ClearVisitLog();
+ }
+};
+
+} // 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
@@ -100,7 +124,7 @@ class HistoryService::BackendDelegate : public HistoryBackend::Delegate {
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 +135,7 @@ HistoryService::HistoryService()
}
HistoryService::HistoryService(Profile* profile)
- : thread_(new base::Thread(kHistoryThreadName)),
+ : thread_(new ChromeHistoryThread()),
profile_(profile),
backend_loaded_(false) {
registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED,
diff --git a/chrome/browser/history/visit_log.cc b/chrome/browser/history/visit_log.cc
index 2c74265..00f9fdc 100644
--- a/chrome/browser/history/visit_log.cc
+++ b/chrome/browser/history/visit_log.cc
@@ -53,4 +53,9 @@ void AddEventToVisitLog(VisitLog::EventType event) {
g_visit_log->AddEvent(event);
}
+void ClearVisitLog() {
+ g_visit_log = NULL;
+}
+
+
} // namespace history
diff --git a/chrome/browser/history/visit_log.h b/chrome/browser/history/visit_log.h
index 31c4976..4e1634c 100644
--- a/chrome/browser/history/visit_log.h
+++ b/chrome/browser/history/visit_log.h
@@ -55,6 +55,7 @@ class VisitLog {
void InitVisitLog(VisitLog* vlog);
void AddEventToVisitLog(VisitLog::EventType event);
+void ClearVisitLog();
} // namespace history