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

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

Issue 2351513002: net: rename BoundNetLog to NetLogWithSource (Closed)
Patch Set: one more fix, content bound_net_log_ Created 4 years, 3 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 unified diff | Download patch
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 #include "net/ftp/ftp_ctrl_response_buffer.h" 5 #include "net/ftp/ftp_ctrl_response_buffer.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "net/base/parse_number.h" 11 #include "net/base/parse_number.h"
12 #include "base/strings/string_piece.h" 12 #include "base/strings/string_piece.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
15 #include "net/log/net_log_event_type.h" 15 #include "net/log/net_log_event_type.h"
16 16
17 namespace net { 17 namespace net {
18 18
19 // static 19 // static
20 const int FtpCtrlResponse::kInvalidStatusCode = -1; 20 const int FtpCtrlResponse::kInvalidStatusCode = -1;
21 21
22 FtpCtrlResponse::FtpCtrlResponse() : status_code(kInvalidStatusCode) {} 22 FtpCtrlResponse::FtpCtrlResponse() : status_code(kInvalidStatusCode) {}
23 23
24 FtpCtrlResponse::FtpCtrlResponse(const FtpCtrlResponse& other) = default; 24 FtpCtrlResponse::FtpCtrlResponse(const FtpCtrlResponse& other) = default;
25 25
26 FtpCtrlResponse::~FtpCtrlResponse() {} 26 FtpCtrlResponse::~FtpCtrlResponse() {}
27 27
28 FtpCtrlResponseBuffer::FtpCtrlResponseBuffer(const BoundNetLog& net_log) 28 FtpCtrlResponseBuffer::FtpCtrlResponseBuffer(const NetLogWithSource& net_log)
29 : multiline_(false), 29 : multiline_(false), net_log_(net_log) {}
30 net_log_(net_log) {
31 }
32 30
33 FtpCtrlResponseBuffer::~FtpCtrlResponseBuffer() {} 31 FtpCtrlResponseBuffer::~FtpCtrlResponseBuffer() {}
34 32
35 int FtpCtrlResponseBuffer::ConsumeData(const char* data, int data_length) { 33 int FtpCtrlResponseBuffer::ConsumeData(const char* data, int data_length) {
36 buffer_.append(data, data_length); 34 buffer_.append(data, data_length);
37 ExtractFullLinesFromBuffer(); 35 ExtractFullLinesFromBuffer();
38 36
39 while (!lines_.empty()) { 37 while (!lines_.empty()) {
40 ParsedLine line = lines_.front(); 38 ParsedLine line = lines_.front();
41 lines_.pop(); 39 lines_.pop();
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 for (size_t i = 0; i < buffer_.length(); i++) { 151 for (size_t i = 0; i < buffer_.length(); i++) {
154 if (i >= 1 && buffer_[i - 1] == '\r' && buffer_[i] == '\n') { 152 if (i >= 1 && buffer_[i - 1] == '\r' && buffer_[i] == '\n') {
155 lines_.push(ParseLine(buffer_.substr(cut_pos, i - cut_pos - 1))); 153 lines_.push(ParseLine(buffer_.substr(cut_pos, i - cut_pos - 1)));
156 cut_pos = i + 1; 154 cut_pos = i + 1;
157 } 155 }
158 } 156 }
159 buffer_.erase(0, cut_pos); 157 buffer_.erase(0, cut_pos);
160 } 158 }
161 159
162 } // namespace net 160 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698