diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-17 22:10:40 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-17 22:10:40 +0000 |
commit | 62c0b606eea3f6f7d6921a00db235975d7874953 (patch) | |
tree | 9ecc2f602d6d11606764dde484528375a8826ba2 /chrome/common | |
parent | 77799ae0d8d4b4f7a427b885ff5d4ae2b47f248c (diff) | |
download | chromium_src-62c0b606eea3f6f7d6921a00db235975d7874953.zip chromium_src-62c0b606eea3f6f7d6921a00db235975d7874953.tar.gz chromium_src-62c0b606eea3f6f7d6921a00db235975d7874953.tar.bz2 |
Cleanup: Put functions in the same order in the .cc file as the .h file. Remove an unneeded pair of braces.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2809021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50151 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/net/network_change_observer_proxy.cc | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/chrome/common/net/network_change_observer_proxy.cc b/chrome/common/net/network_change_observer_proxy.cc index 346b06d..a8db2d2 100644 --- a/chrome/common/net/network_change_observer_proxy.cc +++ b/chrome/common/net/network_change_observer_proxy.cc @@ -63,6 +63,26 @@ NetworkChangeObserverProxy::NetworkChangeObserverProxy( DCHECK_EQ(MessageLoop::current(), target_message_loop_); } +void NetworkChangeObserverProxy::Attach( + net::NetworkChangeNotifier::Observer* target_observer) { + DCHECK_EQ(MessageLoop::current(), target_message_loop_); + DCHECK(!target_observer_); + target_observer_ = target_observer; + DCHECK(target_observer_); + source_thread_->GetMessageLoop()->PostTask( + FROM_HERE, + NewRunnableMethod(this, &NetworkChangeObserverProxy::Observe)); +} + +void NetworkChangeObserverProxy::Detach() { + DCHECK_EQ(MessageLoop::current(), target_message_loop_); + DCHECK(target_observer_); + target_observer_ = NULL; + source_thread_->GetMessageLoop()->PostTask( + FROM_HERE, + NewRunnableMethod(this, &NetworkChangeObserverProxy::Unobserve)); +} + NetworkChangeObserverProxy::~NetworkChangeObserverProxy() { MessageLoop* current_message_loop = MessageLoop::current(); // We can be deleted on either the source or target thread, so the @@ -93,26 +113,6 @@ void NetworkChangeObserverProxy::Unobserve() { source_network_change_notifier->RemoveObserver(this); } -void NetworkChangeObserverProxy::Attach( - net::NetworkChangeNotifier::Observer* target_observer) { - DCHECK_EQ(MessageLoop::current(), target_message_loop_); - DCHECK(!target_observer_); - target_observer_ = target_observer; - DCHECK(target_observer_); - source_thread_->GetMessageLoop()->PostTask( - FROM_HERE, - NewRunnableMethod(this, &NetworkChangeObserverProxy::Observe)); -} - -void NetworkChangeObserverProxy::Detach() { - DCHECK_EQ(MessageLoop::current(), target_message_loop_); - DCHECK(target_observer_); - target_observer_ = NULL; - source_thread_->GetMessageLoop()->PostTask( - FROM_HERE, - NewRunnableMethod(this, &NetworkChangeObserverProxy::Unobserve)); -} - // Although we may get this event after Detach() has been called on // the target thread, we know that Unobserve() hasn't been called yet. // But we know that it has been posted, so it at least holds a @@ -130,9 +130,8 @@ void NetworkChangeObserverProxy::OnIPAddressChanged() { // us (this is how we can get deleted on the target thread). void NetworkChangeObserverProxy::TargetObserverOnIPAddressChanged() { DCHECK_EQ(MessageLoop::current(), target_message_loop_); - if (target_observer_) { + if (target_observer_) target_observer_->OnIPAddressChanged(); - } } } // namespace chrome_common_net |