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

Side by Side Diff: net/ftp/ftp_ctrl_response_buffer.h

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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 #ifndef NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ 6 #ifndef NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_
7 #define NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ 7 #define NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_
8 8
9 #include <queue> 9 #include <queue>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "net/base/net_export.h" 14 #include "net/base/net_export.h"
15 #include "net/base/net_log.h"
15 16
16 namespace net { 17 namespace net {
17 18
18 struct NET_EXPORT_PRIVATE FtpCtrlResponse { 19 struct NET_EXPORT_PRIVATE FtpCtrlResponse {
19 static const int kInvalidStatusCode; 20 static const int kInvalidStatusCode;
20 21
21 FtpCtrlResponse(); 22 FtpCtrlResponse();
22 ~FtpCtrlResponse(); 23 ~FtpCtrlResponse();
23 24
24 int status_code; // Three-digit status code. 25 int status_code; // Three-digit status code.
25 std::vector<std::string> lines; // Response lines, without CRLFs. 26 std::vector<std::string> lines; // Response lines, without CRLFs.
26 }; 27 };
27 28
28 class NET_EXPORT_PRIVATE FtpCtrlResponseBuffer { 29 class NET_EXPORT_PRIVATE FtpCtrlResponseBuffer {
29 public: 30 public:
30 FtpCtrlResponseBuffer(); 31 FtpCtrlResponseBuffer(const BoundNetLog& net_log);
31 ~FtpCtrlResponseBuffer(); 32 ~FtpCtrlResponseBuffer();
32 33
33 // Called when data is received from the control socket. Returns error code. 34 // Called when data is received from the control socket. Returns error code.
34 int ConsumeData(const char* data, int data_length); 35 int ConsumeData(const char* data, int data_length);
35 36
36 bool ResponseAvailable() const { 37 bool ResponseAvailable() const {
37 return !responses_.empty(); 38 return !responses_.empty();
38 } 39 }
39 40
40 // Returns the next response. It is an error to call this function 41 // Returns the next response. It is an error to call this function
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // will have a continuation. So always store last line of multiline response 84 // will have a continuation. So always store last line of multiline response
84 // so we can append the continuation to it. 85 // so we can append the continuation to it.
85 std::string line_buf_; 86 std::string line_buf_;
86 87
87 // Keep the response data while we add all lines to it. 88 // Keep the response data while we add all lines to it.
88 FtpCtrlResponse response_buf_; 89 FtpCtrlResponse response_buf_;
89 90
90 // As we read full responses (possibly multiline), we add them to the queue. 91 // As we read full responses (possibly multiline), we add them to the queue.
91 std::queue<FtpCtrlResponse> responses_; 92 std::queue<FtpCtrlResponse> responses_;
92 93
94 BoundNetLog net_log_;
95
93 DISALLOW_COPY_AND_ASSIGN(FtpCtrlResponseBuffer); 96 DISALLOW_COPY_AND_ASSIGN(FtpCtrlResponseBuffer);
94 }; 97 };
95 98
96 } // namespace net 99 } // namespace net
97 100
98 #endif // NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ 101 #endif // NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698