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

Side by Side Diff: chromecast/net/connectivity_checker_impl.h

Issue 1169163002: Add timeout check for connectivity_checker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add timeout check for connectivity_checker. Created 5 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CHROMECAST_NET_CONNECTIVITY_CHECKER_IMPL_H_ 5 #ifndef CHROMECAST_NET_CONNECTIVITY_CHECKER_IMPL_H_
6 #define CHROMECAST_NET_CONNECTIVITY_CHECKER_IMPL_H_ 6 #define CHROMECAST_NET_CONNECTIVITY_CHECKER_IMPL_H_
7 7
8 #include "base/cancelable_callback.h"
8 #include "chromecast/net/connectivity_checker.h" 9 #include "chromecast/net/connectivity_checker.h"
9 #include "net/base/network_change_notifier.h" 10 #include "net/base/network_change_notifier.h"
10 #include "net/url_request/url_request.h" 11 #include "net/url_request/url_request.h"
11 12
12 class GURL; 13 class GURL;
13 14
14 namespace base { 15 namespace base {
15 class SingleThreadTaskRunner; 16 class SingleThreadTaskRunner;
16 } 17 }
17 18
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 58
58 // Cancels current connectivity checking in progress. 59 // Cancels current connectivity checking in progress.
59 void Cancel(); 60 void Cancel();
60 61
61 // Sets connectivity and alerts observers if it has changed 62 // Sets connectivity and alerts observers if it has changed
62 void SetConnected(bool connected); 63 void SetConnected(bool connected);
63 64
64 // Called when URL request failed. 65 // Called when URL request failed.
65 void OnUrlRequestError(); 66 void OnUrlRequestError();
66 67
68 // Called when URL request timed out.
69 void OnUrlRequestTimeout();
70
67 scoped_ptr<GURL> connectivity_check_url_; 71 scoped_ptr<GURL> connectivity_check_url_;
68 scoped_ptr<net::URLRequestContext> url_request_context_; 72 scoped_ptr<net::URLRequestContext> url_request_context_;
69 scoped_ptr<net::URLRequest> url_request_; 73 scoped_ptr<net::URLRequest> url_request_;
70 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 74 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
71 bool connected_; 75 bool connected_;
72 // Number of connectivity check errors. 76 // Number of connectivity check errors.
73 unsigned int check_errors_; 77 unsigned int check_errors_;
78 base::CancelableCallback<void()> timeout_;
74 79
75 DISALLOW_COPY_AND_ASSIGN(ConnectivityCheckerImpl); 80 DISALLOW_COPY_AND_ASSIGN(ConnectivityCheckerImpl);
76 }; 81 };
77 82
78 } // namespace chromecast 83 } // namespace chromecast
79 84
80 #endif // CHROMECAST_NET_CONNECTIVITY_CHECKER_IMPL_H_ 85 #endif // CHROMECAST_NET_CONNECTIVITY_CHECKER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | chromecast/net/connectivity_checker_impl.cc » ('j') | chromecast/net/connectivity_checker_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698