OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/http/http_stream_parser.h" | 5 #include "net/http/http_stream_parser.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/profiler/scoped_profile.h" |
10 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
11 #include "base/values.h" | 12 #include "base/values.h" |
12 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
13 #include "net/base/ip_endpoint.h" | 14 #include "net/base/ip_endpoint.h" |
14 #include "net/base/upload_data_stream.h" | 15 #include "net/base/upload_data_stream.h" |
15 #include "net/http/http_chunked_decoder.h" | 16 #include "net/http/http_chunked_decoder.h" |
16 #include "net/http/http_request_headers.h" | 17 #include "net/http/http_request_headers.h" |
17 #include "net/http/http_request_info.h" | 18 #include "net/http/http_request_info.h" |
18 #include "net/http/http_response_headers.h" | 19 #include "net/http/http_response_headers.h" |
19 #include "net/http/http_util.h" | 20 #include "net/http/http_util.h" |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 io_state_ = STATE_READ_BODY; | 351 io_state_ = STATE_READ_BODY; |
351 | 352 |
352 int result = DoLoop(OK); | 353 int result = DoLoop(OK); |
353 if (result == ERR_IO_PENDING) | 354 if (result == ERR_IO_PENDING) |
354 callback_ = callback; | 355 callback_ = callback; |
355 | 356 |
356 return result; | 357 return result; |
357 } | 358 } |
358 | 359 |
359 void HttpStreamParser::OnIOComplete(int result) { | 360 void HttpStreamParser::OnIOComplete(int result) { |
| 361 // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. |
| 362 tracked_objects::ScopedProfile tracking_profile( |
| 363 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 364 "418183 DidCompleteReadWrite => HttpStreamParser::OnIOComplete")); |
| 365 |
360 result = DoLoop(result); | 366 result = DoLoop(result); |
361 | 367 |
362 // The client callback can do anything, including destroying this class, | 368 // The client callback can do anything, including destroying this class, |
363 // so any pending callback must be issued after everything else is done. | 369 // so any pending callback must be issued after everything else is done. |
364 if (result != ERR_IO_PENDING && !callback_.is_null()) { | 370 if (result != ERR_IO_PENDING && !callback_.is_null()) { |
365 CompletionCallback c = callback_; | 371 CompletionCallback c = callback_; |
366 callback_.Reset(); | 372 callback_.Reset(); |
367 c.Run(result); | 373 c.Run(result); |
368 } | 374 } |
369 } | 375 } |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 request_body->IsInMemory() && | 1051 request_body->IsInMemory() && |
1046 request_body->size() > 0) { | 1052 request_body->size() > 0) { |
1047 size_t merged_size = request_headers.size() + request_body->size(); | 1053 size_t merged_size = request_headers.size() + request_body->size(); |
1048 if (merged_size <= kMaxMergedHeaderAndBodySize) | 1054 if (merged_size <= kMaxMergedHeaderAndBodySize) |
1049 return true; | 1055 return true; |
1050 } | 1056 } |
1051 return false; | 1057 return false; |
1052 } | 1058 } |
1053 | 1059 |
1054 } // namespace net | 1060 } // namespace net |
OLD | NEW |