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

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

Issue 18660004: Extension activity log database refactoring (step 1) (Closed) Base URL: http://git.chromium.org/chromium/src.git@incognito-tests
Patch Set: Cleanup Created 7 years, 5 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: chrome/browser/extensions/activity_log/activity_log.cc
diff --git a/chrome/browser/extensions/activity_log/activity_log.cc b/chrome/browser/extensions/activity_log/activity_log.cc
index f2b38ba97372581f83387c85c23dc65cb37cadb7..a72e531ea00414072c594159e893ab7c01e609d0 100644
--- a/chrome/browser/extensions/activity_log/activity_log.cc
+++ b/chrome/browser/extensions/activity_log/activity_log.cc
@@ -132,7 +132,11 @@ ActivityLogFactory::~ActivityLogFactory() {
void ActivityLog::SetDefaultPolicy(ActivityLogPolicy::PolicyType policy_type) {
// Can't use IsLogEnabled() here because this is called from inside Init.
if (policy_type != policy_type_ && enabled_) {
- delete policy_;
+ // Changing policies once one has been installed is not currently
+ // supported. After calling Close() on the old policy, there is no way to
+ // wait for changes to be flushed to disk to know that it is safe to
+ // potentially reopen the database with a new policy.
+ CHECK(policy_ == NULL);
felt 2013/07/10 18:35:17 Can you make this a DCHECK?
switch (policy_type) {
case ActivityLogPolicy::POLICY_FULLSTREAM:
policy_ = new FullStreamUIPolicy(profile_);
@@ -207,8 +211,7 @@ void ActivityLog::Shutdown() {
}
ActivityLog::~ActivityLog() {
- // TODO(felt): Turn policy_ into a scoped_ptr.
- delete policy_;
+ policy_->Close();
}
bool ActivityLog::IsLogEnabled() {

Powered by Google App Engine
This is Rietveld 408576698