Index: chrome/browser/history/history.cc |
=================================================================== |
--- chrome/browser/history/history.cc (revision 25782) |
+++ 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,31 @@ |
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 |
// the history service (otherwise we would have to manually AddRef and |
@@ -100,7 +124,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 +135,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, |