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

Unified Diff: net/base/net_log.cc

Issue 1716007: Cleanup: Address some of the todos in net_log.h... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Address willchan's comments 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_event_type_list.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 45472)
+++ net/base/net_log.cc (working copy)
@@ -5,6 +5,7 @@
#include "net/base/net_log.h"
#include "base/logging.h"
#include "base/string_util.h"
+#include "base/values.h"
namespace net {
@@ -63,12 +64,21 @@
}
void BoundNetLog::AddEventWithInteger(NetLog::EventType event_type,
- int integer) const {
+ const char* name,
+ int value) const {
scoped_refptr<NetLog::EventParameters> params =
- new NetLogIntegerParameter(integer);
+ 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);
}
@@ -80,16 +90,18 @@
}
void BoundNetLog::BeginEventWithString(NetLog::EventType event_type,
- const std::string& string) const {
+ const char* name,
+ const std::string& value) const {
scoped_refptr<NetLog::EventParameters> params =
- new NetLogStringParameter(string);
+ new NetLogStringParameter(name, value);
BeginEventWithParameters(event_type, params);
}
void BoundNetLog::BeginEventWithInteger(NetLog::EventType event_type,
- int integer) const {
+ const char* name,
+ int value) const {
scoped_refptr<NetLog::EventParameters> params =
- new NetLogIntegerParameter(integer);
+ new NetLogIntegerParameter(name, value);
BeginEventWithParameters(event_type, params);
}
@@ -104,30 +116,13 @@
}
void BoundNetLog::EndEventWithInteger(NetLog::EventType event_type,
- int integer) const {
+ const char* name,
+ int value) const {
scoped_refptr<NetLog::EventParameters> params =
- new NetLogIntegerParameter(integer);
+ new NetLogIntegerParameter(name, value);
EndEventWithParameters(event_type, params);
}
-void BoundNetLog::AddString(const std::string& string) const {
- // We pass TYPE_TODO_STRING since we have no event type to associate this
- // with. (AddString() is deprecated, and should be replaced with
- // AddEventWithParameters()).
- scoped_refptr<NetLog::EventParameters> params =
- new NetLogStringParameter(string);
- AddEventWithParameters(NetLog::TYPE_TODO_STRING, params);
-}
-
-void BoundNetLog::AddStringLiteral(const char* literal) const {
- // We pass TYPE_TODO_STRING_LITERAL since we have no event type to associate
- // this with. (AddString() is deprecated, and should be replaced with
- // AddEventWithParameters()).
- scoped_refptr<NetLog::EventParameters> params =
- new NetLogStringLiteralParameter(literal);
- AddEventWithParameters(NetLog::TYPE_TODO_STRING_LITERAL, params);
-}
-
// static
BoundNetLog BoundNetLog::Make(NetLog* net_log,
NetLog::SourceType source_type) {
@@ -138,16 +133,21 @@
return BoundNetLog(source, net_log);
}
-NetLogStringParameter::NetLogStringParameter(const std::string& value)
- : value_(value) {
+NetLogStringParameter::NetLogStringParameter(const char* name,
+ const std::string& value)
+ : name_(name), value_(value) {
}
-std::string NetLogIntegerParameter::ToString() const {
- return IntToString(value_);
+Value* NetLogIntegerParameter::ToValue() const {
+ DictionaryValue* dict = new DictionaryValue();
+ dict->SetInteger(ASCIIToWide(name_), value_);
+ return dict;
}
-std::string NetLogStringLiteralParameter::ToString() const {
- return std::string(value_);
+Value* NetLogStringParameter::ToValue() const {
+ DictionaryValue* dict = new DictionaryValue();
+ dict->SetString(ASCIIToWide(name_), value_);
+ return dict;
}
void CapturingNetLog::AddEntry(EventType type,
« no previous file with comments | « net/base/net_log.h ('k') | net/base/net_log_event_type_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698