diff options
-rw-r--r-- | net/base/file_stream_posix.cc | 12 | ||||
-rw-r--r-- | net/base/net_log.cc | 80 | ||||
-rw-r--r-- | net/base/net_log.h | 117 | ||||
-rw-r--r-- | net/http/http_request_headers_unittest.cc | 1 | ||||
-rw-r--r-- | net/http/http_response_headers_unittest.cc | 1 | ||||
-rw-r--r-- | net/tools/gdig/file_net_log.cc | 1 |
6 files changed, 9 insertions, 203 deletions
diff --git a/net/base/file_stream_posix.cc b/net/base/file_stream_posix.cc index 26e3fed..0cbd0bd 100644 --- a/net/base/file_stream_posix.cc +++ b/net/base/file_stream_posix.cc @@ -83,7 +83,7 @@ void OpenFile(const FilePath& path, *result = OK; *file = base::CreatePlatformFile(path, open_flags, NULL, NULL); if (*file == base::kInvalidPlatformFileValue) { - bound_net_log.EndEvent(net::NetLog::TYPE_FILE_STREAM_OPEN, NULL); + bound_net_log.EndEvent(net::NetLog::TYPE_FILE_STREAM_OPEN); *result = RecordAndMapError(errno, FILE_ERROR_SOURCE_OPEN, record_uma, bound_net_log); } @@ -104,13 +104,13 @@ void OpenFileAndSignal(const FilePath& path, // Closes a file with some network logging. void CloseFile(base::PlatformFile file, const net::BoundNetLog& bound_net_log) { - bound_net_log.AddEvent(net::NetLog::TYPE_FILE_STREAM_CLOSE, NULL); + bound_net_log.AddEvent(net::NetLog::TYPE_FILE_STREAM_CLOSE); if (file == base::kInvalidPlatformFileValue) return; if (!base::ClosePlatformFile(file)) NOTREACHED(); - bound_net_log.EndEvent(net::NetLog::TYPE_FILE_STREAM_OPEN, NULL); + bound_net_log.EndEvent(net::NetLog::TYPE_FILE_STREAM_OPEN); } // Closes a file with CloseFile() and signals the completion. @@ -257,7 +257,7 @@ FileStreamPosix::FileStreamPosix(net::NetLog* net_log) bound_net_log_(net::BoundNetLog::Make(net_log, net::NetLog::SOURCE_FILESTREAM)), weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { - bound_net_log_.BeginEvent(net::NetLog::TYPE_FILE_STREAM_ALIVE, NULL); + bound_net_log_.BeginEvent(net::NetLog::TYPE_FILE_STREAM_ALIVE); } FileStreamPosix::FileStreamPosix( @@ -269,7 +269,7 @@ FileStreamPosix::FileStreamPosix( bound_net_log_(net::BoundNetLog::Make(net_log, net::NetLog::SOURCE_FILESTREAM)), weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { - bound_net_log_.BeginEvent(net::NetLog::TYPE_FILE_STREAM_ALIVE, NULL); + bound_net_log_.BeginEvent(net::NetLog::TYPE_FILE_STREAM_ALIVE); } FileStreamPosix::~FileStreamPosix() { @@ -294,7 +294,7 @@ FileStreamPosix::~FileStreamPosix() { } } - bound_net_log_.EndEvent(net::NetLog::TYPE_FILE_STREAM_ALIVE, NULL); + bound_net_log_.EndEvent(net::NetLog::TYPE_FILE_STREAM_ALIVE); } void FileStreamPosix::Close(const CompletionCallback& callback) { diff --git a/net/base/net_log.cc b/net/base/net_log.cc index a2f22dc..f15ce95 100644 --- a/net/base/net_log.cc +++ b/net/base/net_log.cc @@ -30,14 +30,6 @@ Value* BytesTransferredCallback(int byte_count, return dict; } -Value* EventParametersCallback( - const scoped_refptr<NetLog::EventParameters>& params, - NetLog::LogLevel /* log_level */) { - if (!params.get()) - return NULL; - return params->ToValue(); -} - Value* SourceEventParametersCallback(const NetLog::Source source, NetLog::LogLevel /* log_level */) { if (!source.is_valid()) @@ -81,13 +73,6 @@ Value* NetLogString16Callback(const char* name, } // namespace -Value* NetLog::Source::ToValue() const { - DictionaryValue* dict = new DictionaryValue(); - dict->SetInteger("type", static_cast<int>(type)); - dict->SetInteger("id", static_cast<int>(id)); - return dict; -} - void NetLog::Source::AddToEventParameters(DictionaryValue* event_params) const { DictionaryValue* dict = new DictionaryValue(); dict->SetInteger("type", static_cast<int>(type)); @@ -203,15 +188,6 @@ void NetLog::AddGlobalEntry( ¶meters_callback); } -void NetLog::AddGlobalEntry(EventType type, - const scoped_refptr<EventParameters>& params) { - ParametersCallback callback = base::Bind(&EventParametersCallback, params); - AddEntry(type, - Source(net::NetLog::SOURCE_NONE, NextID()), - net::NetLog::PHASE_NONE, - &callback); -} - // static std::string NetLog::TickCountToString(const base::TimeTicks& time) { int64 delta_time = (time - base::TimeTicks()).InMilliseconds(); @@ -381,35 +357,6 @@ void BoundNetLog::EndEvent( AddEntry(type, NetLog::PHASE_END, get_parameters); } -void BoundNetLog::AddEntry( - NetLog::EventType type, - NetLog::EventPhase phase, - const scoped_refptr<NetLog::EventParameters>& params) const { - if (!net_log_) - return; - NetLog::ParametersCallback callback = - base::Bind(&EventParametersCallback, params); - net_log_->AddEntry(type, source_, phase, &callback); -} - -void BoundNetLog::AddEvent( - NetLog::EventType event_type, - const scoped_refptr<NetLog::EventParameters>& params) const { - AddEntry(event_type, NetLog::PHASE_NONE, params); -} - -void BoundNetLog::BeginEvent( - NetLog::EventType event_type, - const scoped_refptr<NetLog::EventParameters>& params) const { - AddEntry(event_type, NetLog::PHASE_BEGIN, params); -} - -void BoundNetLog::EndEvent( - NetLog::EventType event_type, - const scoped_refptr<NetLog::EventParameters>& params) const { - AddEntry(event_type, NetLog::PHASE_END, params); -} - void BoundNetLog::AddEventWithNetErrorCode(NetLog::EventType event_type, int net_error) const { DCHECK_GT(0, net_error); @@ -457,31 +404,4 @@ BoundNetLog BoundNetLog::Make(NetLog* net_log, return BoundNetLog(source, net_log); } -NetLogStringParameter::NetLogStringParameter(const char* name, - const std::string& value) - : name_(name), value_(value) { -} - -NetLogStringParameter::~NetLogStringParameter() { -} - -Value* NetLogIntegerParameter::ToValue() const { - DictionaryValue* dict = new DictionaryValue(); - dict->SetInteger(name_, value_); - return dict; -} - -Value* NetLogStringParameter::ToValue() const { - DictionaryValue* dict = new DictionaryValue(); - dict->SetString(name_, value_); - return dict; -} - -Value* NetLogSourceParameter::ToValue() const { - DictionaryValue* dict = new DictionaryValue(); - if (value_.is_valid()) - dict->Set(name_, value_.ToValue()); - return dict; -} - } // namespace net diff --git a/net/base/net_log.h b/net/base/net_log.h index f5f9260..3b796e2 100644 --- a/net/base/net_log.h +++ b/net/base/net_log.h @@ -11,8 +11,6 @@ #include "base/basictypes.h" #include "base/callback_forward.h" #include "base/compiler_specific.h" -#include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/string16.h" #include "net/base/net_export.h" @@ -92,10 +90,6 @@ class NET_EXPORT NetLog { Source(SourceType type, uint32 id) : type(type), id(id) {} bool is_valid() const { return id != kInvalidId; } - // Obsolete. The caller takes ownership of the returned Value*. - // TODO(mmenke): Remove this. - base::Value* ToValue() const; - // Adds the source to a DictionaryValue containing event parameters, // using the name "source_dependency". void AddToEventParameters(base::DictionaryValue* event_params) const; @@ -114,30 +108,6 @@ class NET_EXPORT NetLog { uint32 id; }; - // Base class for associating additional parameters with an event. Log - // observers need to know what specific derivations of EventParameters a - // particular EventType uses, in order to get at the individual components. - // This class is obsolete. New code should use ParametersCallbacks. - // TODO(mmenke): Update users of this class and get rid of it. - class NET_EXPORT EventParameters - : public base::RefCountedThreadSafe<EventParameters> { - public: - EventParameters() {} - - // Serializes the parameters to a Value tree. This is intended to be a - // lossless conversion, which is used to serialize the parameters to JSON. - // The caller takes ownership of the returned Value*. - virtual base::Value* ToValue() const = 0; - - protected: - virtual ~EventParameters() {} - - private: - friend class base::RefCountedThreadSafe<EventParameters>; - - DISALLOW_COPY_AND_ASSIGN(EventParameters); - }; - class NET_EXPORT Entry { public: Entry(EventType type, @@ -226,12 +196,6 @@ class NET_EXPORT NetLog { void AddGlobalEntry(EventType type, const NetLog::ParametersCallback& parameters_callback); - // Older, obsolete version of above functions. Use the ParametersCallback - // versions instead. - // TODO(mmenke): Remove this. - void AddGlobalEntry(EventType type, - const scoped_refptr<EventParameters>& params); - // Returns a unique ID which can be used as a source ID. All returned IDs // will be unique and greater than 0. virtual uint32 NextID() = 0; @@ -367,19 +331,6 @@ class NET_EXPORT BoundNetLog { void AddEvent(NetLog::EventType type, const NetLog::ParametersCallback& get_parameters) const; - // Obsolete versions of the above functions. - // Use the ParametersCallback versions of these functions instead. - // TODO(mmenke): Remove these. - void AddEntry(NetLog::EventType type, - NetLog::EventPhase phase, - const scoped_refptr<NetLog::EventParameters>& params) const; - void AddEvent(NetLog::EventType event_type, - const scoped_refptr<NetLog::EventParameters>& params) const; - void BeginEvent(NetLog::EventType event_type, - const scoped_refptr<NetLog::EventParameters>& params) const; - void EndEvent(NetLog::EventType event_type, - const scoped_refptr<NetLog::EventParameters>& params) const; - // Just like AddEvent, except |net_error| is a net error code. A parameter // called "net_error" with the indicated value will be recorded for the event. // |net_error| must be negative, and not ERR_IO_PENDING, as it's not a true @@ -423,74 +374,6 @@ class NET_EXPORT BoundNetLog { NetLog* net_log_; }; -// All the classes below are obsolete. New code should use ParametersCallbacks. -// TODO(mmenke): Update users these classes and get rid of them. - -// NetLogStringParameter is a subclass of EventParameters that encapsulates a -// single std::string parameter. -class NET_EXPORT NetLogStringParameter : public NetLog::EventParameters { - public: - // |name| must be a string literal. - NetLogStringParameter(const char* name, const std::string& value); - - const std::string& value() const { - return value_; - } - - virtual base::Value* ToValue() const OVERRIDE; - - protected: - virtual ~NetLogStringParameter(); - - private: - const char* const name_; - const std::string value_; -}; - -// NetLogIntegerParameter is a subclass of EventParameters that encapsulates a -// single integer parameter. -class NET_EXPORT NetLogIntegerParameter : public NetLog::EventParameters { - public: - // |name| must be a string literal. - NetLogIntegerParameter(const char* name, int value) - : name_(name), value_(value) {} - - int value() const { - return value_; - } - - virtual base::Value* ToValue() const OVERRIDE; - - protected: - virtual ~NetLogIntegerParameter() {} - - private: - const char* name_; - const int value_; -}; - -// NetLogSourceParameter is a subclass of EventParameters that encapsulates a -// single NetLog::Source parameter. -class NET_EXPORT NetLogSourceParameter : public NetLog::EventParameters { - public: - // |name| must be a string literal. - NetLogSourceParameter(const char* name, const NetLog::Source& value) - : name_(name), value_(value) {} - - const NetLog::Source& value() const { - return value_; - } - - virtual base::Value* ToValue() const OVERRIDE; - - protected: - virtual ~NetLogSourceParameter() {} - - private: - const char* name_; - const NetLog::Source value_; -}; - } // namespace net #endif // NET_BASE_NET_LOG_H_ diff --git a/net/http/http_request_headers_unittest.cc b/net/http/http_request_headers_unittest.cc index 6346f50..d33b473 100644 --- a/net/http/http_request_headers_unittest.cc +++ b/net/http/http_request_headers_unittest.cc @@ -4,6 +4,7 @@ #include "net/http/http_request_headers.h" +#include "base/memory/scoped_ptr.h" #include "base/values.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc index d93c5bd..00608e2 100644 --- a/net/http/http_response_headers_unittest.cc +++ b/net/http/http_response_headers_unittest.cc @@ -5,6 +5,7 @@ #include <algorithm> #include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" #include "base/pickle.h" #include "base/time.h" #include "base/values.h" diff --git a/net/tools/gdig/file_net_log.cc b/net/tools/gdig/file_net_log.cc index 13d271e..90967de 100644 --- a/net/tools/gdig/file_net_log.cc +++ b/net/tools/gdig/file_net_log.cc @@ -6,6 +6,7 @@ #include "base/json/json_string_value_serializer.h" #include "base/logging.h" +#include "base/memory/scoped_ptr.h" #include "base/values.h" #include "net/tools/gdig/file_net_log.h" |