summaryrefslogtreecommitdiffstats
path: root/net/base/capturing_net_log.cc
diff options
context:
space:
mode:
authormmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-15 05:22:13 +0000
committermmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-15 05:22:13 +0000
commitfba65f7b1dbb530401030f9aac9886a0e75fe4c2 (patch)
tree2c292ca19939fe79e646d5f2b579186acc51d6b9 /net/base/capturing_net_log.cc
parent4fd13395a6cfaecb0463563b4deaa1e7b8eff87c (diff)
downloadchromium_src-fba65f7b1dbb530401030f9aac9886a0e75fe4c2.zip
chromium_src-fba65f7b1dbb530401030f9aac9886a0e75fe4c2.tar.gz
chromium_src-fba65f7b1dbb530401030f9aac9886a0e75fe4c2.tar.bz2
Add a source id to global NetLog entries, which makes them
easier to sort in about:net-internals, making the world a happier, fuzzier place. Also slightly simplifies the functions to add NetLog entries, and makes it impossible to create a BoundNetLog with both an invalid source and a non-NULL NetLog. BUG=116597 Review URL: https://chromiumcodereview.appspot.com/9585026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126849 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/capturing_net_log.cc')
-rw-r--r--net/base/capturing_net_log.cc31
1 files changed, 15 insertions, 16 deletions
diff --git a/net/base/capturing_net_log.cc b/net/base/capturing_net_log.cc
index 3d36982..2c6867c 100644
--- a/net/base/capturing_net_log.cc
+++ b/net/base/capturing_net_log.cc
@@ -20,7 +20,7 @@ CapturingNetLog::Entry::Entry(EventType type,
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 @@ void CapturingNetLog::SetLogLevel(NetLog::LogLevel log_level) {
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 @@ void CapturingNetLog::RemoveThreadSafeObserver(
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_(new CapturingNetLog(max_num_entries)) {}
+ : capturing_net_log_(max_num_entries),
+ net_log_(BoundNetLog::Make(&capturing_net_log_,
+ net::NetLog::SOURCE_NONE)) {
+}
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