diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-21 22:40:35 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-21 22:40:35 +0000 |
commit | 740e6bdb0b63c45e1e44d73f473f330b69853c1c (patch) | |
tree | 83e2ef11c38fe80cf3666de06cfc6f2a8b9181ef /chrome/service/net | |
parent | 3d8d1c9f38d1f4f26a56ad03d3fa920791bc50ea (diff) | |
download | chromium_src-740e6bdb0b63c45e1e44d73f473f330b69853c1c.zip chromium_src-740e6bdb0b63c45e1e44d73f473f330b69853c1c.tar.gz chromium_src-740e6bdb0b63c45e1e44d73f473f330b69853c1c.tar.bz2 |
Pass in NetLog to NetworkChangeNotifier.
BUG=46822
Review URL: http://codereview.chromium.org/2857009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50402 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service/net')
3 files changed, 16 insertions, 13 deletions
diff --git a/chrome/service/net/service_network_change_notifier_thread.cc b/chrome/service/net/service_network_change_notifier_thread.cc index 3ccd146..227b2ca 100644 --- a/chrome/service/net/service_network_change_notifier_thread.cc +++ b/chrome/service/net/service_network_change_notifier_thread.cc @@ -9,8 +9,10 @@ #include "net/base/network_change_notifier.h" ServiceNetworkChangeNotifierThread::ServiceNetworkChangeNotifierThread( - MessageLoop* io_thread_message_loop) - : io_thread_message_loop_(io_thread_message_loop) { + MessageLoop* io_thread_message_loop, + net::NetLog* net_log) + : io_thread_message_loop_(io_thread_message_loop), + net_log_(net_log) { DCHECK(io_thread_message_loop_); } @@ -34,13 +36,12 @@ MessageLoop* ServiceNetworkChangeNotifierThread::GetMessageLoop() const { net::NetworkChangeNotifier* ServiceNetworkChangeNotifierThread::GetNetworkChangeNotifier() const { - DCHECK(MessageLoop::current() == io_thread_message_loop_); + DCHECK_EQ(MessageLoop::current(), io_thread_message_loop_); return network_change_notifier_.get(); } void ServiceNetworkChangeNotifierThread::CreateNetworkChangeNotifier() { - DCHECK(MessageLoop::current() == io_thread_message_loop_); + DCHECK_EQ(MessageLoop::current(), io_thread_message_loop_); network_change_notifier_.reset( - net::NetworkChangeNotifier::CreateDefaultNetworkChangeNotifier()); + net::NetworkChangeNotifier::CreateDefaultNetworkChangeNotifier(net_log_)); } - diff --git a/chrome/service/net/service_network_change_notifier_thread.h b/chrome/service/net/service_network_change_notifier_thread.h index 14975a6..cb73f31 100644 --- a/chrome/service/net/service_network_change_notifier_thread.h +++ b/chrome/service/net/service_network_change_notifier_thread.h @@ -13,6 +13,7 @@ class MessageLoop; namespace net { +class NetLog; class NetworkChangeNotifier; } // namespace net @@ -25,8 +26,9 @@ class ServiceNetworkChangeNotifierThread // Does not take ownership of |io_thread_message_loop|. This instance must // live no longer than |io_thread_message_loop|. // TODO(sanjeevr): Change NetworkChangeNotifierThread to use MessageLoopProxy - explicit ServiceNetworkChangeNotifierThread( - MessageLoop* io_thread_message_loop); + ServiceNetworkChangeNotifierThread( + MessageLoop* io_thread_message_loop, + net::NetLog* net_log); virtual ~ServiceNetworkChangeNotifierThread(); // Initialize MUST be called before this class can be used. @@ -39,12 +41,13 @@ class ServiceNetworkChangeNotifierThread virtual net::NetworkChangeNotifier* GetNetworkChangeNotifier() const; private: + void CreateNetworkChangeNotifier(); + MessageLoop* const io_thread_message_loop_; + net::NetLog* const net_log_; scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; - void CreateNetworkChangeNotifier(); DISALLOW_COPY_AND_ASSIGN(ServiceNetworkChangeNotifierThread); }; #endif // CHROME_SERVICE_NET_SERVICE_NETWORK_CHANGE_NOTIFIER_THREAD_H_ - diff --git a/chrome/service/net/service_network_change_notifier_thread_unittest.cc b/chrome/service/net/service_network_change_notifier_thread_unittest.cc index 917d51a..9cf544a 100644 --- a/chrome/service/net/service_network_change_notifier_thread_unittest.cc +++ b/chrome/service/net/service_network_change_notifier_thread_unittest.cc @@ -65,7 +65,7 @@ void CheckNullNetworkChangeNotifier( TEST_F(ServiceNetworkChangeNotifierThreadTest, Basic) { scoped_refptr<ServiceNetworkChangeNotifierThread> change_notifier_thread = - new ServiceNetworkChangeNotifierThread(io_thread_.message_loop()); + new ServiceNetworkChangeNotifierThread(io_thread_.message_loop(), NULL); EXPECT_EQ(io_thread_.message_loop(), change_notifier_thread->GetMessageLoop()); change_notifier_thread->Initialize(); @@ -81,7 +81,7 @@ TEST_F(ServiceNetworkChangeNotifierThreadTest, Basic) { TEST_F(ServiceNetworkChangeNotifierThreadTest, Uninitialized) { scoped_refptr<ServiceNetworkChangeNotifierThread> change_notifier_thread = - new ServiceNetworkChangeNotifierThread(io_thread_.message_loop()); + new ServiceNetworkChangeNotifierThread(io_thread_.message_loop(), NULL); EXPECT_EQ(io_thread_.message_loop(), change_notifier_thread->GetMessageLoop()); // We have not called Initialize. Expect the GetNetworkChangeNotifier() call @@ -97,4 +97,3 @@ TEST_F(ServiceNetworkChangeNotifierThreadTest, Uninitialized) { } } // namespace - |