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 "content/browser/loader/resource_loader.h" | 5 #include "content/browser/loader/resource_loader.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 // Make sure we track the buffer in at least one place. This ensures it gets | 655 // Make sure we track the buffer in at least one place. This ensures it gets |
656 // deleted even in the case the request has already finished its job and | 656 // deleted even in the case the request has already finished its job and |
657 // doesn't use the buffer. | 657 // doesn't use the buffer. |
658 scoped_refptr<net::IOBuffer> buf; | 658 scoped_refptr<net::IOBuffer> buf; |
659 int buf_size; | 659 int buf_size; |
660 { | 660 { |
661 // TODO(darin): Remove ScopedTracker below once crbug.com/475761 is fixed. | 661 // TODO(darin): Remove ScopedTracker below once crbug.com/475761 is fixed. |
662 tracked_objects::ScopedTracker tracking_profile2( | 662 tracked_objects::ScopedTracker tracking_profile2( |
663 FROM_HERE_WITH_EXPLICIT_FUNCTION("475761 OnWillRead()")); | 663 FROM_HERE_WITH_EXPLICIT_FUNCTION("475761 OnWillRead()")); |
664 | 664 |
665 if (!handler_->OnWillRead(&buf, &buf_size, -1)) { | 665 if (!handler_->OnWillRead(&buf, &buf_size)) { |
666 // Cancel the request, which will then call back into |this| to inform it | 666 // Cancel the request, which will then call back into |this| to inform it |
667 // of a "read error". | 667 // of a "read error". |
668 Cancel(); | 668 Cancel(); |
669 return; | 669 return; |
670 } | 670 } |
671 } | 671 } |
672 | 672 |
673 DCHECK(buf.get()); | 673 DCHECK(buf.get()); |
674 DCHECK(buf_size > 0); | 674 DCHECK(buf_size > 0); |
675 | 675 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", prefetch_status, | 802 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", prefetch_status, |
803 STATUS_MAX); | 803 STATUS_MAX); |
804 } | 804 } |
805 } else if (request_->response_info().unused_since_prefetch) { | 805 } else if (request_->response_info().unused_since_prefetch) { |
806 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); | 806 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); |
807 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); | 807 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); |
808 } | 808 } |
809 } | 809 } |
810 | 810 |
811 } // namespace content | 811 } // namespace content |
OLD | NEW |