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

Unified Diff: net/base/capturing_net_log.cc

Issue 10399083: Make NetLog take in callbacks that return Values (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix net-internals Created 8 years, 7 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: net/base/capturing_net_log.cc
===================================================================
--- net/base/capturing_net_log.cc (revision 137673)
+++ net/base/capturing_net_log.cc (working copy)
@@ -5,19 +5,19 @@
#include "net/base/capturing_net_log.h"
#include "base/logging.h"
+#include "base/values.h"
namespace net {
-CapturingNetLog::Entry::Entry(EventType type,
- const base::TimeTicks& time,
- Source source,
- EventPhase phase,
- EventParameters* extra_parameters)
- : type(type), time(time), source(source), phase(phase),
- extra_parameters(extra_parameters) {
+CapturingNetLog::CapturedEntry::CapturedEntry(
+ EventType type,
+ const base::TimeTicks& time,
+ Source source,
+ EventPhase phase)
+ : type(type), time(time), source(source), phase(phase) {
}
-CapturingNetLog::Entry::~Entry() {}
+CapturingNetLog::CapturedEntry::~CapturedEntry() {}
CapturingNetLog::CapturingNetLog(size_t max_num_entries)
: last_id_(0),
@@ -27,14 +27,14 @@
CapturingNetLog::~CapturingNetLog() {}
-void CapturingNetLog::GetEntries(EntryList* entry_list) const {
+void CapturingNetLog::GetEntries(CapturedEntryList* entry_list) const {
base::AutoLock lock(lock_);
- *entry_list = entries_;
+ *entry_list = captured_entries_;
}
void CapturingNetLog::Clear() {
base::AutoLock lock(lock_);
- entries_.clear();
+ captured_entries_.clear();
}
void CapturingNetLog::SetLogLevel(NetLog::LogLevel log_level) {
@@ -42,16 +42,16 @@
log_level_ = log_level;
}
-void CapturingNetLog::AddEntry(
- EventType type,
- const Source& source,
- EventPhase phase,
- const scoped_refptr<EventParameters>& extra_parameters) {
- DCHECK(source.is_valid());
+void CapturingNetLog::OnAddEntry(const net::NetLog::Entry& entry) {
+ DCHECK(entry.source().is_valid());
base::AutoLock lock(lock_);
- Entry entry(type, base::TimeTicks::Now(), source, phase, extra_parameters);
- if (entries_.size() + 1 < max_num_entries_)
- entries_.push_back(entry);
+ if (captured_entries_.size() >= max_num_entries_)
+ return;
+ captured_entries_.push_back(
+ CapturedEntry(entry.type(),
+ base::TimeTicks::Now(),
+ entry.source(),
+ entry.phase()));
}
uint32 CapturingNetLog::NextID() {
@@ -88,7 +88,7 @@
CapturingBoundNetLog::~CapturingBoundNetLog() {}
void CapturingBoundNetLog::GetEntries(
- CapturingNetLog::EntryList* entry_list) const {
+ CapturingNetLog::CapturedEntryList* entry_list) const {
capturing_net_log_.GetEntries(entry_list);
}
« no previous file with comments | « net/base/capturing_net_log.h ('k') | net/base/net_log.h » ('j') | net/base/net_log.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698