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

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: Change lifetime management for policies 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..e9219999d2de6f6935b087d6f22b31db34228602 100644
--- a/chrome/browser/extensions/activity_log/activity_log.cc
+++ b/chrome/browser/extensions/activity_log/activity_log.cc
@@ -132,7 +132,8 @@ 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_;
+ if (policy_)
+ policy_->Close();
felt 2013/07/09 22:14:51 What if Close() hasn't finished before policy is r
mvrable 2013/07/09 23:03:22 That occurred to me earlier; I think the current c
felt 2013/07/10 00:14:36 At present, I don't expect this code path will be
mvrable 2013/07/10 17:49:17 I've changed this to a CHECK to catch cases where
felt 2013/07/10 18:35:17 LogWithoutArguments should be triggering this code
mvrable 2013/07/10 18:53:56 I somehow missed this since I wasn't running that
mvrable 2013/07/10 20:48:41 I convinced myself (and Adrienne, in an offline di
switch (policy_type) {
case ActivityLogPolicy::POLICY_FULLSTREAM:
policy_ = new FullStreamUIPolicy(profile_);
@@ -207,8 +208,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