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

Side by Side Diff: net/url_request/url_request.cc

Issue 10837123: Add histograms to NetworkChangeNotifier to identify ways to improve interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address szym's comments and nits. Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « net/base/network_change_notifier.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/url_request/url_request.h" 5 #include "net/url_request/url_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/debug/stack_trace.h" 11 #include "base/debug/stack_trace.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/metrics/stats_counters.h" 15 #include "base/metrics/stats_counters.h"
16 #include "base/stl_util.h" 16 #include "base/stl_util.h"
17 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
18 #include "net/base/auth.h" 18 #include "net/base/auth.h"
19 #include "net/base/host_port_pair.h" 19 #include "net/base/host_port_pair.h"
20 #include "net/base/load_flags.h" 20 #include "net/base/load_flags.h"
21 #include "net/base/net_errors.h" 21 #include "net/base/net_errors.h"
22 #include "net/base/net_log.h" 22 #include "net/base/net_log.h"
23 #include "net/base/network_change_notifier.h"
23 #include "net/base/network_delegate.h" 24 #include "net/base/network_delegate.h"
24 #include "net/base/ssl_cert_request_info.h" 25 #include "net/base/ssl_cert_request_info.h"
25 #include "net/base/upload_data.h" 26 #include "net/base/upload_data.h"
26 #include "net/http/http_response_headers.h" 27 #include "net/http/http_response_headers.h"
27 #include "net/http/http_util.h" 28 #include "net/http/http_util.h"
28 #include "net/url_request/url_request_context.h" 29 #include "net/url_request/url_request_context.h"
29 #include "net/url_request/url_request_error_job.h" 30 #include "net/url_request/url_request_error_job.h"
30 #include "net/url_request/url_request_job.h" 31 #include "net/url_request/url_request_job.h"
31 #include "net/url_request/url_request_job_manager.h" 32 #include "net/url_request/url_request_job_manager.h"
32 #include "net/url_request/url_request_netlog_params.h" 33 #include "net/url_request/url_request_netlog_params.h"
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 } 873 }
873 return g_default_can_use_cookies; 874 return g_default_can_use_cookies;
874 } 875 }
875 876
876 877
877 void URLRequest::NotifyReadCompleted(int bytes_read) { 878 void URLRequest::NotifyReadCompleted(int bytes_read) {
878 // Notify in case the entire URL Request has been finished. 879 // Notify in case the entire URL Request has been finished.
879 if (bytes_read <= 0) 880 if (bytes_read <= 0)
880 NotifyRequestCompleted(); 881 NotifyRequestCompleted();
881 882
883 // Notify NetworkChangeNotifier that we just received network data.
884 // This is to identify cases where the NetworkChangeNotifier thinks we
885 // are off-line but we are still receiving network data (crbug.com/124069).
886 NetworkChangeNotifier::NotifyDataReceived(url());
887
882 if (delegate_) 888 if (delegate_)
883 delegate_->OnReadCompleted(this, bytes_read); 889 delegate_->OnReadCompleted(this, bytes_read);
884 890
885 // Nothing below this line as OnReadCompleted may delete |this|. 891 // Nothing below this line as OnReadCompleted may delete |this|.
886 } 892 }
887 893
888 void URLRequest::NotifyRequestCompleted() { 894 void URLRequest::NotifyRequestCompleted() {
889 // TODO(battre): Get rid of this check, according to willchan it should 895 // TODO(battre): Get rid of this check, according to willchan it should
890 // not be needed. 896 // not be needed.
891 if (has_notified_completion_) 897 if (has_notified_completion_)
(...skipping 23 matching lines...) Expand all
915 new base::debug::StackTrace(NULL, 0); 921 new base::debug::StackTrace(NULL, 0);
916 *stack_trace_copy = stack_trace; 922 *stack_trace_copy = stack_trace;
917 stack_trace_.reset(stack_trace_copy); 923 stack_trace_.reset(stack_trace_copy);
918 } 924 }
919 925
920 const base::debug::StackTrace* URLRequest::stack_trace() const { 926 const base::debug::StackTrace* URLRequest::stack_trace() const {
921 return stack_trace_.get(); 927 return stack_trace_.get();
922 } 928 }
923 929
924 } // namespace net 930 } // namespace net
OLDNEW
« no previous file with comments | « net/base/network_change_notifier.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698