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/profiler/scoped_profile.h" |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. | 361 // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. |
362 tracked_objects::ScopedProfile tracking_profile( | 362 tracked_objects::ScopedProfile tracking_profile( |
363 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 363 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
364 "418183 DidCompleteReadWrite => HttpStreamParser::OnIOComplete")); | 364 "418183 DidCompleteReadWrite => HttpStreamParser::OnIOComplete")); |
365 | 365 |
366 result = DoLoop(result); | 366 result = DoLoop(result); |
367 | 367 |
368 // The client callback can do anything, including destroying this class, | 368 // The client callback can do anything, including destroying this class, |
369 // 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. |
370 if (result != ERR_IO_PENDING && !callback_.is_null()) { | 370 if (result != ERR_IO_PENDING && !callback_.is_null()) { |
| 371 // TODO(vadimt): Remove ScopedProfile below once crbug.com/424359 is fixed. |
| 372 tracked_objects::ScopedProfile tracking_profile( |
| 373 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 374 "424359 HttpStreamParser::OnIOComplete callback")); |
| 375 |
371 CompletionCallback c = callback_; | 376 CompletionCallback c = callback_; |
372 callback_.Reset(); | 377 callback_.Reset(); |
373 c.Run(result); | 378 c.Run(result); |
374 } | 379 } |
375 } | 380 } |
376 | 381 |
377 int HttpStreamParser::DoLoop(int result) { | 382 int HttpStreamParser::DoLoop(int result) { |
| 383 // TODO(vadimt): Remove ScopedProfile below once crbug.com/424359 is fixed. |
| 384 tracked_objects::ScopedProfile tracking_profile( |
| 385 FROM_HERE_WITH_EXPLICIT_FUNCTION("424359 HttpStreamParser::DoLoop")); |
| 386 |
378 do { | 387 do { |
379 DCHECK_NE(ERR_IO_PENDING, result); | 388 DCHECK_NE(ERR_IO_PENDING, result); |
380 DCHECK_NE(STATE_DONE, io_state_); | 389 DCHECK_NE(STATE_DONE, io_state_); |
381 DCHECK_NE(STATE_NONE, io_state_); | 390 DCHECK_NE(STATE_NONE, io_state_); |
382 State state = io_state_; | 391 State state = io_state_; |
383 io_state_ = STATE_NONE; | 392 io_state_ = STATE_NONE; |
384 switch (state) { | 393 switch (state) { |
385 case STATE_SEND_HEADERS: | 394 case STATE_SEND_HEADERS: |
386 DCHECK_EQ(OK, result); | 395 DCHECK_EQ(OK, result); |
387 result = DoSendHeaders(); | 396 result = DoSendHeaders(); |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 request_body->IsInMemory() && | 1060 request_body->IsInMemory() && |
1052 request_body->size() > 0) { | 1061 request_body->size() > 0) { |
1053 size_t merged_size = request_headers.size() + request_body->size(); | 1062 size_t merged_size = request_headers.size() + request_body->size(); |
1054 if (merged_size <= kMaxMergedHeaderAndBodySize) | 1063 if (merged_size <= kMaxMergedHeaderAndBodySize) |
1055 return true; | 1064 return true; |
1056 } | 1065 } |
1057 return false; | 1066 return false; |
1058 } | 1067 } |
1059 | 1068 |
1060 } // namespace net | 1069 } // namespace net |
OLD | NEW |