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

Side by Side Diff: net/base/network_change_notifier_win.h

Issue 10377092: [net/dns] Isolate DnsConfigWatcher from DnsConfigService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments. Braces. Created 8 years, 7 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_ 5 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_
6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_ 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_
7 #pragma once 7 #pragma once
8 8
9 #include <windows.h> 9 #include <windows.h>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
14 #include "base/threading/non_thread_safe.h" 15 #include "base/threading/non_thread_safe.h"
15 #include "base/timer.h" 16 #include "base/timer.h"
16 #include "base/win/object_watcher.h" 17 #include "base/win/object_watcher.h"
17 #include "net/base/net_export.h" 18 #include "net/base/net_export.h"
18 #include "net/base/network_change_notifier.h" 19 #include "net/base/network_change_notifier.h"
19 20
20 namespace net { 21 namespace net {
21 22
22 // NetworkChangeNotifierWin inherits from NonThreadSafe, as all its internal 23 // NetworkChangeNotifierWin inherits from NonThreadSafe, as all its internal
(...skipping 17 matching lines...) Expand all
40 41
41 protected: 42 protected:
42 virtual ~NetworkChangeNotifierWin(); 43 virtual ~NetworkChangeNotifierWin();
43 44
44 // For unit tests only. 45 // For unit tests only.
45 bool is_watching() { return is_watching_; } 46 bool is_watching() { return is_watching_; }
46 void set_is_watching(bool is_watching) { is_watching_ = is_watching; } 47 void set_is_watching(bool is_watching) { is_watching_ = is_watching; }
47 int sequential_failures() { return sequential_failures_; } 48 int sequential_failures() { return sequential_failures_; }
48 49
49 private: 50 private:
51 class DnsWatcherThread;
50 friend class NetworkChangeNotifierWinTest; 52 friend class NetworkChangeNotifierWinTest;
51 53
52 // NetworkChangeNotifier methods: 54 // NetworkChangeNotifier methods:
53 virtual bool IsCurrentlyOffline() const OVERRIDE; 55 virtual bool IsCurrentlyOffline() const OVERRIDE;
54 56
55 // ObjectWatcher::Delegate methods: 57 // ObjectWatcher::Delegate methods:
56 // Must only be called on the thread |this| was created on. 58 // Must only be called on the thread |this| was created on.
57 virtual void OnObjectSignaled(HANDLE object) OVERRIDE; 59 virtual void OnObjectSignaled(HANDLE object) OVERRIDE;
58 60
59 // Notifies IP address change observers of a change immediately, and notifies 61 // Notifies IP address change observers of a change immediately, and notifies
(...skipping 22 matching lines...) Expand all
82 OVERLAPPED addr_overlapped_; 84 OVERLAPPED addr_overlapped_;
83 85
84 base::OneShotTimer<NetworkChangeNotifierWin> timer_; 86 base::OneShotTimer<NetworkChangeNotifierWin> timer_;
85 87
86 // Number of times WatchForAddressChange has failed in a row. 88 // Number of times WatchForAddressChange has failed in a row.
87 int sequential_failures_; 89 int sequential_failures_;
88 90
89 // Used for calling WatchForAddressChange again on failure. 91 // Used for calling WatchForAddressChange again on failure.
90 base::WeakPtrFactory<NetworkChangeNotifierWin> weak_factory_; 92 base::WeakPtrFactory<NetworkChangeNotifierWin> weak_factory_;
91 93
94 // Thread on which we can run DnsConfigWatcher.
95 scoped_ptr<DnsWatcherThread> dns_watcher_thread_;
96
92 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierWin); 97 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierWin);
93 }; 98 };
94 99
95 } // namespace net 100 } // namespace net
96 101
97 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_ 102 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698