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

Unified Diff: net/ftp/ftp_ctrl_response_buffer.cc

Issue 11377007: FTP: add net-internals logging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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/ftp/ftp_ctrl_response_buffer.cc
diff --git a/net/ftp/ftp_ctrl_response_buffer.cc b/net/ftp/ftp_ctrl_response_buffer.cc
index 670c70d61814b78192b0282706790f5c60e4359a..f86f804ee1fe20d46d1047f61f997c38cc0df320 100644
--- a/net/ftp/ftp_ctrl_response_buffer.cc
+++ b/net/ftp/ftp_ctrl_response_buffer.cc
@@ -4,10 +4,11 @@
#include "net/ftp/ftp_ctrl_response_buffer.h"
+#include "base/bind.h"
#include "base/logging.h"
#include "base/string_number_conversions.h"
#include "base/string_piece.h"
-//#include "base/string_util.h"
+#include "base/values.h"
#include "net/base/net_errors.h"
namespace net {
@@ -19,7 +20,10 @@ FtpCtrlResponse::FtpCtrlResponse() : status_code(kInvalidStatusCode) {}
FtpCtrlResponse::~FtpCtrlResponse() {}
-FtpCtrlResponseBuffer::FtpCtrlResponseBuffer() : multiline_(false) {}
+FtpCtrlResponseBuffer::FtpCtrlResponseBuffer(const BoundNetLog& net_log)
+ : multiline_(false),
+ net_log_(net_log) {
+}
FtpCtrlResponseBuffer::~FtpCtrlResponseBuffer() {}
@@ -73,9 +77,28 @@ int FtpCtrlResponseBuffer::ConsumeData(const char* data, int data_length) {
return OK;
}
+namespace {
+
+Value* NetLogFtpCtrlResponseCallback(const FtpCtrlResponse& response,
+ NetLog::LogLevel log_level) {
+ ListValue* lines = new ListValue();
+ lines->AppendStrings(response.lines);
+
+ DictionaryValue* dict = new DictionaryValue();
+ dict->SetInteger("status_code", response.status_code);
+ dict->Set("lines", lines);
+ return dict;
+}
+
+} // namespace
+
FtpCtrlResponse FtpCtrlResponseBuffer::PopResponse() {
FtpCtrlResponse result = responses_.front();
responses_.pop();
+
+ net_log_.AddEvent(NetLog::TYPE_FTP_CONTROL_RESPONSE,
+ base::Bind(&NetLogFtpCtrlResponseCallback, result));
eroman 2012/11/06 23:49:29 Note that this line will cause |result| to be copi
Paweł Hajdan Jr. 2012/11/07 00:42:56 Done.
+
return result;
}

Powered by Google App Engine
This is Rietveld 408576698