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

Unified Diff: net/base/capturing_net_log.cc

Issue 9585026: Add a source id to global NetLog entries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Missed one Created 8 years, 9 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
« no previous file with comments | « net/base/capturing_net_log.h ('k') | net/base/file_stream_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/capturing_net_log.cc
===================================================================
--- net/base/capturing_net_log.cc (revision 126769)
+++ net/base/capturing_net_log.cc (working copy)
@@ -20,7 +20,7 @@
CapturingNetLog::Entry::~Entry() {}
CapturingNetLog::CapturingNetLog(size_t max_num_entries)
- : last_id_(-1),
+ : last_id_(0),
max_num_entries_(max_num_entries),
log_level_(LOG_ALL_BUT_BYTES) {
}
@@ -42,13 +42,14 @@
log_level_ = log_level;
}
-void CapturingNetLog::AddEntry(EventType type,
- const base::TimeTicks& time,
- const Source& source,
- EventPhase phase,
- EventParameters* extra_parameters) {
+void CapturingNetLog::AddEntry(
+ EventType type,
+ const Source& source,
+ EventPhase phase,
+ const scoped_refptr<EventParameters>& extra_parameters) {
+ DCHECK(source.is_valid());
base::AutoLock lock(lock_);
- Entry entry(type, time, source, phase, extra_parameters);
+ Entry entry(type, base::TimeTicks::Now(), source, phase, extra_parameters);
if (entries_.size() + 1 < max_num_entries_)
entries_.push_back(entry);
}
@@ -78,27 +79,25 @@
NOTIMPLEMENTED() << "Not currently used by net unit tests.";
}
-CapturingBoundNetLog::CapturingBoundNetLog(const NetLog::Source& source,
- CapturingNetLog* net_log)
- : source_(source), capturing_net_log_(net_log) {
+CapturingBoundNetLog::CapturingBoundNetLog(size_t max_num_entries)
+ : capturing_net_log_(max_num_entries),
+ net_log_(BoundNetLog::Make(&capturing_net_log_,
+ net::NetLog::SOURCE_NONE)) {
}
-CapturingBoundNetLog::CapturingBoundNetLog(size_t max_num_entries)
- : capturing_net_log_(new CapturingNetLog(max_num_entries)) {}
-
CapturingBoundNetLog::~CapturingBoundNetLog() {}
void CapturingBoundNetLog::GetEntries(
CapturingNetLog::EntryList* entry_list) const {
- capturing_net_log_->GetEntries(entry_list);
+ capturing_net_log_.GetEntries(entry_list);
}
void CapturingBoundNetLog::Clear() {
- capturing_net_log_->Clear();
+ capturing_net_log_.Clear();
}
void CapturingBoundNetLog::SetLogLevel(NetLog::LogLevel log_level) {
- capturing_net_log_->SetLogLevel(log_level);
+ capturing_net_log_.SetLogLevel(log_level);
}
} // namespace net
« no previous file with comments | « net/base/capturing_net_log.h ('k') | net/base/file_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698