Chromium Code Reviews| 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() { |