Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <set> | 5 #include <set> |
| 6 #include <vector> | 6 #include <vector> |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 } | 125 } |
| 126 | 126 |
| 127 ActivityLogFactory::~ActivityLogFactory() { | 127 ActivityLogFactory::~ActivityLogFactory() { |
| 128 } | 128 } |
| 129 | 129 |
| 130 // ActivityLog | 130 // ActivityLog |
| 131 | 131 |
| 132 void ActivityLog::SetDefaultPolicy(ActivityLogPolicy::PolicyType policy_type) { | 132 void ActivityLog::SetDefaultPolicy(ActivityLogPolicy::PolicyType policy_type) { |
| 133 // Can't use IsLogEnabled() here because this is called from inside Init. | 133 // Can't use IsLogEnabled() here because this is called from inside Init. |
| 134 if (policy_type != policy_type_ && enabled_) { | 134 if (policy_type != policy_type_ && enabled_) { |
| 135 delete policy_; | 135 if (policy_) |
| 136 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
| |
| 136 switch (policy_type) { | 137 switch (policy_type) { |
| 137 case ActivityLogPolicy::POLICY_FULLSTREAM: | 138 case ActivityLogPolicy::POLICY_FULLSTREAM: |
| 138 policy_ = new FullStreamUIPolicy(profile_); | 139 policy_ = new FullStreamUIPolicy(profile_); |
| 139 break; | 140 break; |
| 140 case ActivityLogPolicy::POLICY_NOARGS: | 141 case ActivityLogPolicy::POLICY_NOARGS: |
| 141 policy_ = new StreamWithoutArgsUIPolicy(profile_); | 142 policy_ = new StreamWithoutArgsUIPolicy(profile_); |
| 142 break; | 143 break; |
| 143 default: | 144 default: |
| 144 NOTREACHED(); | 145 NOTREACHED(); |
| 145 } | 146 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 SetDefaultPolicy(ActivityLogPolicy::POLICY_FULLSTREAM); | 201 SetDefaultPolicy(ActivityLogPolicy::POLICY_FULLSTREAM); |
| 201 else | 202 else |
| 202 SetDefaultPolicy(ActivityLogPolicy::POLICY_NOARGS); | 203 SetDefaultPolicy(ActivityLogPolicy::POLICY_NOARGS); |
| 203 } | 204 } |
| 204 | 205 |
| 205 void ActivityLog::Shutdown() { | 206 void ActivityLog::Shutdown() { |
| 206 if (tracker_) tracker_->RemoveObserver(this); | 207 if (tracker_) tracker_->RemoveObserver(this); |
| 207 } | 208 } |
| 208 | 209 |
| 209 ActivityLog::~ActivityLog() { | 210 ActivityLog::~ActivityLog() { |
| 210 // TODO(felt): Turn policy_ into a scoped_ptr. | 211 policy_->Close(); |
| 211 delete policy_; | |
| 212 } | 212 } |
| 213 | 213 |
| 214 bool ActivityLog::IsLogEnabled() { | 214 bool ActivityLog::IsLogEnabled() { |
| 215 if (!has_threads_ || !initialized_) return false; | 215 if (!has_threads_ || !initialized_) return false; |
| 216 return enabled_; | 216 return enabled_; |
| 217 } | 217 } |
| 218 | 218 |
| 219 void ActivityLog::OnExtensionInstalled(const Extension* extension) { | 219 void ActivityLog::OnExtensionInstalled(const Extension* extension) { |
| 220 if (extension->id() != kActivityLogExtensionId) return; | 220 if (extension->id() != kActivityLogExtensionId) return; |
| 221 enabled_ = true; | 221 enabled_ = true; |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 web_contents->GetTitle(), | 504 web_contents->GetTitle(), |
| 505 std::string(), // no api call here | 505 std::string(), // no api call here |
| 506 script_names.get(), | 506 script_names.get(), |
| 507 DomActionType::INSERTED, | 507 DomActionType::INSERTED, |
| 508 extra); | 508 extra); |
| 509 } | 509 } |
| 510 } | 510 } |
| 511 } | 511 } |
| 512 | 512 |
| 513 } // namespace extensions | 513 } // namespace extensions |
| OLD | NEW |