Chromium Code Reviews| Index: net/base/capturing_net_log.cc |
| =================================================================== |
| --- net/base/capturing_net_log.cc (revision 65207) |
| +++ net/base/capturing_net_log.cc (working copy) |
| @@ -28,21 +28,29 @@ |
| const Source& source, |
| EventPhase phase, |
| EventParameters* extra_parameters) { |
| + AutoLock lock(lock_); |
| Entry entry(type, time, source, phase, extra_parameters); |
| if (entries_.size() + 1 < max_num_entries_) |
| entries_.push_back(entry); |
| } |
| uint32 CapturingNetLog::NextID() { |
| - return next_id_++; |
| + return base::subtle::NoBarrier_AtomicIncrement(&next_id_, 1)-1; |
|
eroman
2010/11/18 18:04:03
I suggest doing what you did in the other file for
|
| } |
| +void CapturingNetLog::GetEntries(EntryList* entry_list) const { |
| + AutoLock lock(lock_); |
| + *entry_list = entries_; |
| +} |
| + |
| void CapturingNetLog::Clear() { |
| + AutoLock lock(lock_); |
| entries_.clear(); |
| } |
| -CapturingBoundNetLog::CapturingBoundNetLog(const NetLog::Source& source, |
| - CapturingNetLog* net_log) |
| +CapturingBoundNetLog::CapturingBoundNetLog( |
| + const NetLog::Source& source, |
| + scoped_refptr<CapturingNetLog>& net_log) |
| : source_(source), capturing_net_log_(net_log) { |
| } |
| @@ -51,13 +59,20 @@ |
| CapturingBoundNetLog::~CapturingBoundNetLog() {} |
| +void CapturingBoundNetLog::GetEntries( |
| + CapturingNetLog::EntryList* entry_list) const { |
| + capturing_net_log_->GetEntries(entry_list); |
| +} |
| + |
| void CapturingBoundNetLog::Clear() { |
| capturing_net_log_->Clear(); |
| } |
| void CapturingBoundNetLog::AppendTo(const BoundNetLog& net_log) const { |
|
eroman
2010/11/18 18:04:03
See earlier comment -- i don't think this is neede
|
| - for (size_t i = 0; i < entries().size(); ++i) { |
| - const CapturingNetLog::Entry& entry = entries()[i]; |
| + CapturingNetLog::EntryList entries; |
| + GetEntries(&entries); |
| + for (size_t i = 0; i < entries.size(); ++i) { |
| + const CapturingNetLog::Entry& entry = entries[i]; |
| net_log.AddEntryWithTime(entry.type, entry.time, entry.phase, |
| entry.extra_parameters); |
| } |