Index: trunk/src/chrome/browser/extensions/activity_log/activity_log.cc |
=================================================================== |
--- trunk/src/chrome/browser/extensions/activity_log/activity_log.cc (revision 205306) |
+++ trunk/src/chrome/browser/extensions/activity_log/activity_log.cc (working copy) |
@@ -26,6 +26,7 @@ |
#include "components/browser_context_keyed_service/browser_context_dependency_manager.h" |
#include "content/public/browser/web_contents.h" |
#include "googleurl/src/gurl.h" |
+#include "sql/error_delegate_util.h" |
#include "third_party/re2/re2/re2.h" |
namespace { |
@@ -168,6 +169,8 @@ |
base::FilePath base_dir = profile->GetPath(); |
base::FilePath database_name = base_dir.Append( |
chrome::kExtensionActivityLogFilename); |
+ db_->SetErrorCallback(base::Bind(&ActivityLog::DatabaseErrorCallback, |
+ base::Unretained(this))); |
ScheduleAndForget(&ActivityDatabase::Init, database_name); |
} |
@@ -176,10 +179,7 @@ |
} |
ActivityLog::~ActivityLog() { |
- if (has_threads_) |
- ScheduleAndForget(&ActivityDatabase::Close); |
- else |
- db_->Close(); |
+ ScheduleAndForget(&ActivityDatabase::Close); |
} |
// We can't register for the InstallTrackerFactory events or talk to the |
@@ -451,4 +451,9 @@ |
} |
} |
+void ActivityLog::DatabaseErrorCallback(int error, sql::Statement* stmt) { |
+ if (sql::IsErrorCatastrophic(error)) |
+ ScheduleAndForget(&ActivityDatabase::KillDatabase); |
+} |
+ |
} // namespace extensions |