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

Unified Diff: trunk/src/chrome/browser/extensions/activity_log/activity_log.cc

Issue 16756004: Revert 205059 "We were seeing ActivityLog memory leaks and assor..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 6 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/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

Powered by Google App Engine
This is Rietveld 408576698