summaryrefslogtreecommitdiffstats
path: root/net/base/net_log.cc
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-28 19:28:09 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-28 19:28:09 +0000
commitec11be60eaf6e832219328ea18656c558dec3040 (patch)
tree1d8a6710f277a55b4743fbc54c8554abf3164669 /net/base/net_log.cc
parent9bb75ccc56cdb94a9778dcef26be3de97808f3ce (diff)
downloadchromium_src-ec11be60eaf6e832219328ea18656c558dec3040.zip
chromium_src-ec11be60eaf6e832219328ea18656c558dec3040.tar.gz
chromium_src-ec11be60eaf6e832219328ea18656c558dec3040.tar.bz2
More cleanup to address TODOs in net_log.h.
* Removes 9 methods: AddEventWithParameters, BeginEventWithParameters, EndEventWithParameters, BeginEventWithString, BeginEventWithInteger, AddEventWithString, AddEventWithInteger, EndEventWithParameters, EndEventWithInteger. This was becoming ridiculous, instead made the EventParameters* a required parameter. * Moves CapturingBoundNetLog / CapturingNetLog to its own file. BUG=37421 Review URL: http://codereview.chromium.org/1746012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45843 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/net_log.cc')
-rw-r--r--net/base/net_log.cc109
1 files changed, 13 insertions, 96 deletions
diff --git a/net/base/net_log.cc b/net/base/net_log.cc
index c46214f..02b6bbd 100644
--- a/net/base/net_log.cc
+++ b/net/base/net_log.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "net/base/net_log.h"
-#include "base/logging.h"
#include "base/string_util.h"
#include "base/values.h"
@@ -28,12 +27,12 @@ std::vector<NetLog::EventType> NetLog::GetAllEventTypes() {
return types;
}
-void BoundNetLog::AddEntry(NetLog::EventType type,
- NetLog::EventPhase phase,
- NetLog::EventParameters* extra_parameters) const {
+void BoundNetLog::AddEntry(
+ NetLog::EventType type,
+ NetLog::EventPhase phase,
+ const scoped_refptr<NetLog::EventParameters>& params) const {
if (net_log_) {
- net_log_->AddEntry(type, base::TimeTicks::Now(), source_, phase,
- extra_parameters);
+ net_log_->AddEntry(type, base::TimeTicks::Now(), source_, phase, params);
}
}
@@ -41,9 +40,9 @@ void BoundNetLog::AddEntryWithTime(
NetLog::EventType type,
const base::TimeTicks& time,
NetLog::EventPhase phase,
- NetLog::EventParameters* extra_parameters) const {
+ const scoped_refptr<NetLog::EventParameters>& params) const {
if (net_log_) {
- net_log_->AddEntry(type, time, source_, phase, extra_parameters);
+ net_log_->AddEntry(type, time, source_, phase, params);
}
}
@@ -53,76 +52,24 @@ bool BoundNetLog::HasListener() const {
return false;
}
-void BoundNetLog::AddEvent(NetLog::EventType event_type) const {
- AddEventWithParameters(event_type, NULL);
-}
-
-void BoundNetLog::AddEventWithParameters(
+void BoundNetLog::AddEvent(
NetLog::EventType event_type,
- NetLog::EventParameters* params) const {
+ const scoped_refptr<NetLog::EventParameters>& params) const {
AddEntry(event_type, NetLog::PHASE_NONE, params);
}
-void BoundNetLog::AddEventWithInteger(NetLog::EventType event_type,
- const char* name,
- int value) const {
- scoped_refptr<NetLog::EventParameters> params =
- new NetLogIntegerParameter(name, value);
- AddEventWithParameters(event_type, params);
-}
-
-void BoundNetLog::AddEventWithString(NetLog::EventType event_type,
- const char* name,
- const std::string& value) const {
- scoped_refptr<NetLog::EventParameters> params =
- new NetLogStringParameter(name, value);
- AddEventWithParameters(event_type, params);
-}
-
-void BoundNetLog::BeginEvent(NetLog::EventType event_type) const {
- BeginEventWithParameters(event_type, NULL);
-}
-
-void BoundNetLog::BeginEventWithParameters(
+void BoundNetLog::BeginEvent(
NetLog::EventType event_type,
- NetLog::EventParameters* params) const {
+ const scoped_refptr<NetLog::EventParameters>& params) const {
AddEntry(event_type, NetLog::PHASE_BEGIN, params);
}
-void BoundNetLog::BeginEventWithString(NetLog::EventType event_type,
- const char* name,
- const std::string& value) const {
- scoped_refptr<NetLog::EventParameters> params =
- new NetLogStringParameter(name, value);
- BeginEventWithParameters(event_type, params);
-}
-
-void BoundNetLog::BeginEventWithInteger(NetLog::EventType event_type,
- const char* name,
- int value) const {
- scoped_refptr<NetLog::EventParameters> params =
- new NetLogIntegerParameter(name, value);
- BeginEventWithParameters(event_type, params);
-}
-
-void BoundNetLog::EndEvent(NetLog::EventType event_type) const {
- EndEventWithParameters(event_type, NULL);
-}
-
-void BoundNetLog::EndEventWithParameters(
+void BoundNetLog::EndEvent(
NetLog::EventType event_type,
- NetLog::EventParameters* params) const {
+ const scoped_refptr<NetLog::EventParameters>& params) const {
AddEntry(event_type, NetLog::PHASE_END, params);
}
-void BoundNetLog::EndEventWithInteger(NetLog::EventType event_type,
- const char* name,
- int value) const {
- scoped_refptr<NetLog::EventParameters> params =
- new NetLogIntegerParameter(name, value);
- EndEventWithParameters(event_type, params);
-}
-
// static
BoundNetLog BoundNetLog::Make(NetLog* net_log,
NetLog::SourceType source_type) {
@@ -150,34 +97,4 @@ Value* NetLogStringParameter::ToValue() const {
return dict;
}
-void CapturingNetLog::AddEntry(EventType type,
- const base::TimeTicks& time,
- const Source& source,
- EventPhase phase,
- EventParameters* extra_parameters) {
- 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_++;
-}
-
-void CapturingNetLog::Clear() {
- entries_.clear();
-}
-
-void CapturingBoundNetLog::Clear() {
- capturing_net_log_->Clear();
-}
-
-void CapturingBoundNetLog::AppendTo(const BoundNetLog& net_log) const {
- 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);
- }
-}
-
} // namespace net