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_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/format_macros.h" | 13 #include "base/format_macros.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/metrics/field_trial.h" | 15 #include "base/metrics/field_trial.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 #include "base/metrics/stats_counters.h" | 17 #include "base/metrics/stats_counters.h" |
18 #include "base/profiler/scoped_profile.h" | 18 #include "base/profiler/scoped_tracker.h" |
19 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
23 #include "base/time/time.h" | 23 #include "base/time/time.h" |
24 #include "base/values.h" | 24 #include "base/values.h" |
25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
26 #include "net/base/auth.h" | 26 #include "net/base/auth.h" |
27 #include "net/base/host_port_pair.h" | 27 #include "net/base/host_port_pair.h" |
28 #include "net/base/io_buffer.h" | 28 #include "net/base/io_buffer.h" |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 DCHECK_NE(rv, ERR_IO_PENDING); | 591 DCHECK_NE(rv, ERR_IO_PENDING); |
592 DCHECK(!callback_.is_null()); | 592 DCHECK(!callback_.is_null()); |
593 | 593 |
594 // Since Run may result in Read being called, clear user_callback_ up front. | 594 // Since Run may result in Read being called, clear user_callback_ up front. |
595 CompletionCallback c = callback_; | 595 CompletionCallback c = callback_; |
596 callback_.Reset(); | 596 callback_.Reset(); |
597 c.Run(rv); | 597 c.Run(rv); |
598 } | 598 } |
599 | 599 |
600 void HttpNetworkTransaction::OnIOComplete(int result) { | 600 void HttpNetworkTransaction::OnIOComplete(int result) { |
601 // TODO(vadimt): Remove ScopedProfile below once crbug.com/424359 is fixed. | 601 // TODO(vadimt): Remove ScopedTracker below once crbug.com/424359 is fixed. |
602 tracked_objects::ScopedProfile tracking_profile1( | 602 tracked_objects::ScopedTracker tracking_profile1( |
603 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 603 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
604 "424359 HttpNetworkTransaction::OnIOComplete 1")); | 604 "424359 HttpNetworkTransaction::OnIOComplete 1")); |
605 | 605 |
606 int rv = DoLoop(result); | 606 int rv = DoLoop(result); |
607 | 607 |
608 // TODO(vadimt): Remove ScopedProfile below once crbug.com/424359 is fixed. | 608 // TODO(vadimt): Remove ScopedTracker below once crbug.com/424359 is fixed. |
609 tracked_objects::ScopedProfile tracking_profile2( | 609 tracked_objects::ScopedTracker tracking_profile2( |
610 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 610 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
611 "424359 HttpNetworkTransaction::OnIOComplete 2")); | 611 "424359 HttpNetworkTransaction::OnIOComplete 2")); |
612 | 612 |
613 if (rv != ERR_IO_PENDING) | 613 if (rv != ERR_IO_PENDING) |
614 DoCallback(rv); | 614 DoCallback(rv); |
615 } | 615 } |
616 | 616 |
617 int HttpNetworkTransaction::DoLoop(int result) { | 617 int HttpNetworkTransaction::DoLoop(int result) { |
618 DCHECK(next_state_ != STATE_NONE); | 618 DCHECK(next_state_ != STATE_NONE); |
619 | 619 |
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1602 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1603 state); | 1603 state); |
1604 break; | 1604 break; |
1605 } | 1605 } |
1606 return description; | 1606 return description; |
1607 } | 1607 } |
1608 | 1608 |
1609 #undef STATE_CASE | 1609 #undef STATE_CASE |
1610 | 1610 |
1611 } // namespace net | 1611 } // namespace net |
OLD | NEW |