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

Unified Diff: net/base/net_log.cc

Issue 1746012: More cleanup of net_log.h (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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/net_log.h ('k') | net/base/net_log_unittest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_log.cc
===================================================================
--- net/base/net_log.cc (revision 45828)
+++ net/base/net_log.cc (working copy)
@@ -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 @@
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 @@
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 @@
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 @@
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
« no previous file with comments | « net/base/net_log.h ('k') | net/base/net_log_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698