summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 11:58:57 +0000
committernkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 11:58:57 +0000
commit236ead5e35b93ff9c1e48d61d5545124af9fe83b (patch)
tree70c62e127698eaa4a37aa830b1a6a63a3b10b2f6
parent2ac06ded4372e8a8f79f97b74bad922098645af5 (diff)
downloadchromium_src-236ead5e35b93ff9c1e48d61d5545124af9fe83b.zip
chromium_src-236ead5e35b93ff9c1e48d61d5545124af9fe83b.tar.gz
chromium_src-236ead5e35b93ff9c1e48d61d5545124af9fe83b.tar.bz2
Revert 144382 - [Sync] Make Login class listen to connection and DNS changes
Reason: http://build.chromium.org/p/chromium/builders/Mac10.6%20Sync/builds/19046 Make sync_listen_notifications listen for network changes. Add a scoped NSAutoreleasePool to sync_listen_notifications. Relax DEPS for sync/tools a bit. BUG=106034 TEST= Review URL: https://chromiumcodereview.appspot.com/10675012 TBR=akalin@chromium.org Review URL: https://chromiumcodereview.appspot.com/10690007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144439 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--jingle/notifier/communicator/login.cc29
-rw-r--r--jingle/notifier/communicator/login.h14
-rw-r--r--sync/tools/DEPS4
-rw-r--r--sync/tools/sync_listen_notifications.cc12
4 files changed, 9 insertions, 50 deletions
diff --git a/jingle/notifier/communicator/login.cc b/jingle/notifier/communicator/login.cc
index 5f6a2861..db4813b 100644
--- a/jingle/notifier/communicator/login.cc
+++ b/jingle/notifier/communicator/login.cc
@@ -43,19 +43,15 @@ Login::Login(Delegate* delegate,
try_ssltcp_first,
auth_mechanism) {
net::NetworkChangeNotifier::AddIPAddressObserver(this);
- net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
- net::NetworkChangeNotifier::AddDNSObserver(this);
ResetReconnectState();
}
Login::~Login() {
- net::NetworkChangeNotifier::RemoveDNSObserver(this);
- net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
}
void Login::StartConnection() {
- DVLOG(1) << "Starting connection...";
+ VLOG(1) << "Starting connection...";
single_attempt_.reset(new SingleLoginAttempt(login_settings_, this));
}
@@ -91,22 +87,7 @@ void Login::OnSettingsExhausted() {
}
void Login::OnIPAddressChanged() {
- DVLOG(1) << "Detected IP address change";
- OnNetworkEvent();
-}
-
-void Login::OnConnectionTypeChanged(
- net::NetworkChangeNotifier::ConnectionType type) {
- DVLOG(1) << "Detected connection type change";
- OnNetworkEvent();
-}
-
-void Login::OnDNSChanged(unsigned detail) {
- DVLOG(1) << "Detected DNS change";
- OnNetworkEvent();
-}
-
-void Login::OnNetworkEvent() {
+ VLOG(1) << "Detected IP address change";
// Reconnect in 1 to 9 seconds (vary the time a little to try to
// avoid spikey behavior on network hiccups).
reconnect_interval_ = base::TimeDelta::FromSeconds(base::RandInt(1, 9));
@@ -124,8 +105,8 @@ void Login::TryReconnect() {
DCHECK_GT(reconnect_interval_.InSeconds(), 0);
single_attempt_.reset();
reconnect_timer_.Stop();
- DVLOG(1) << "Reconnecting in "
- << reconnect_interval_.InSeconds() << " seconds";
+ VLOG(1) << "Reconnecting in "
+ << reconnect_interval_.InSeconds() << " seconds";
reconnect_timer_.Start(
FROM_HERE, reconnect_interval_, this, &Login::DoReconnect);
}
@@ -137,7 +118,7 @@ void Login::DoReconnect() {
reconnect_interval_ *= 2;
if (reconnect_interval_ > kMaxReconnectInterval)
reconnect_interval_ = kMaxReconnectInterval;
- DVLOG(1) << "Reconnecting...";
+ VLOG(1) << "Reconnecting...";
StartConnection();
}
diff --git a/jingle/notifier/communicator/login.h b/jingle/notifier/communicator/login.h
index 7acde11..29be403 100644
--- a/jingle/notifier/communicator/login.h
+++ b/jingle/notifier/communicator/login.h
@@ -36,11 +36,7 @@ class LoginSettings;
// Does the login, keeps it alive (with refreshing cookies and
// reattempting login when disconnected), and figures out what actions
// to take on the various errors that may occur.
-//
-// TODO(akalin): Make this observe proxy config changes also.
class Login : public net::NetworkChangeNotifier::IPAddressObserver,
- public net::NetworkChangeNotifier::ConnectionTypeObserver,
- public net::NetworkChangeNotifier::DNSObserver,
public SingleLoginAttempt::Delegate {
public:
class Delegate {
@@ -85,13 +81,6 @@ class Login : public net::NetworkChangeNotifier::IPAddressObserver,
// net::NetworkChangeNotifier::IPAddressObserver implementation.
virtual void OnIPAddressChanged() OVERRIDE;
- // net::NetworkChangeNotifier::ConnectionTypeObserver implementation.
- virtual void OnConnectionTypeChanged(
- net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
-
- // net::NetworkChangeNotifier::DNSObserver implementation.
- virtual void OnDNSChanged(unsigned detail) OVERRIDE;
-
// SingleLoginAttempt::Delegate implementation.
virtual void OnConnect(
base::WeakPtr<buzz::XmppTaskParentInterface> base_task) OVERRIDE;
@@ -100,8 +89,7 @@ class Login : public net::NetworkChangeNotifier::IPAddressObserver,
virtual void OnSettingsExhausted() OVERRIDE;
private:
- // Called by the various network notifications.
- void OnNetworkEvent();
+ void OnLogoff();
// Stops any existing reconnect timer and sets an initial reconnect
// interval.
diff --git a/sync/tools/DEPS b/sync/tools/DEPS
index e36048b..4c7287a 100644
--- a/sync/tools/DEPS
+++ b/sync/tools/DEPS
@@ -1,6 +1,8 @@
include_rules = [
"+jingle/notifier/base",
- "+net",
+ "+net/base/host_port_pair.h",
+ "+net/base/host_resolver.h",
+ "+net/url_request/url_request_test_util.h",
"+sync/notifier",
"+sync/internal_api/public/syncable",
]
diff --git a/sync/tools/sync_listen_notifications.cc b/sync/tools/sync_listen_notifications.cc
index 0b0f060..ad06080 100644
--- a/sync/tools/sync_listen_notifications.cc
+++ b/sync/tools/sync_listen_notifications.cc
@@ -19,7 +19,6 @@
#include "jingle/notifier/base/notifier_options.h"
#include "net/base/host_port_pair.h"
#include "net/base/host_resolver.h"
-#include "net/base/network_change_notifier.h"
#include "net/url_request/url_request_test_util.h"
#include "sync/internal_api/public/syncable/model_type.h"
#include "sync/internal_api/public/syncable/model_type_payload_map.h"
@@ -29,10 +28,6 @@
#include "sync/notifier/sync_notifier_factory.h"
#include "sync/notifier/sync_notifier_observer.h"
-#if defined(OS_MACOSX)
-#include "base/mac/scoped_nsautorelease_pool.h"
-#endif
-
// This is a simple utility that initializes a sync notifier and
// listens to any received notifications.
@@ -179,9 +174,6 @@ class MyTestURLRequestContextGetter : public TestURLRequestContextGetter {
} // namespace
int main(int argc, char* argv[]) {
-#if defined(OS_MACOSX)
- base::mac::ScopedNSAutoreleasePool pool;
-#endif
base::AtExitManager exit_manager;
CommandLine::Init(argc, argv);
logging::InitLogging(
@@ -218,10 +210,6 @@ int main(int argc, char* argv[]) {
return -1;
}
- // Set up objects that monitor the network.
- scoped_ptr<net::NetworkChangeNotifier> network_change_notifier(
- net::NetworkChangeNotifier::Create());
-
const notifier::NotifierOptions& notifier_options =
ParseNotifierOptions(
command_line,