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

Unified Diff: chrome/browser/sync/engine/net/server_connection_manager.h

Issue 6690020: sync: hook up ServerConnectionManager <> SyncerThread2 and tie up more loose ends (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/debug
Patch Set: fix Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/engine/net/server_connection_manager.h
diff --git a/chrome/browser/sync/engine/net/server_connection_manager.h b/chrome/browser/sync/engine/net/server_connection_manager.h
index 214c6226b4aa9124d9823af7f0121290738d0e4a..9f49d4a45e4a3b4d315d2b522b164a59bd579b5c 100644
--- a/chrome/browser/sync/engine/net/server_connection_manager.h
+++ b/chrome/browser/sync/engine/net/server_connection_manager.h
@@ -10,6 +10,7 @@
#include <string>
#include "base/atomicops.h"
+#include "base/observer_list_threadsafe.h"
#include "base/string_util.h"
#include "base/synchronization/lock.h"
#include "chrome/browser/sync/syncable/syncable_id.h"
@@ -107,6 +108,7 @@ inline bool IsGoodReplyFromServer(HttpResponse::ServerConnectionCode code) {
return code >= HttpResponse::SERVER_CONNECTION_OK;
}
+// TODO(tim): Deprecated.
struct ServerConnectionEvent {
// Traits.
typedef ServerConnectionEvent EventType;
@@ -124,6 +126,21 @@ struct ServerConnectionEvent {
bool server_reachable;
};
+struct ServerConnectionEvent2 {
+ HttpResponse::ServerConnectionCode connection_code;
+ bool server_reachable;
+ ServerConnectionEvent2(HttpResponse::ServerConnectionCode code,
+ bool server_reachable) :
+ connection_code(code), server_reachable(server_reachable) {}
+};
+
+class ServerConnectionEventListener {
+ public:
+ virtual void OnServerConnectionEvent(const ServerConnectionEvent2& event) = 0;
+ protected:
+ virtual ~ServerConnectionEventListener() {}
+};
+
class ServerConnectionManager;
// A helper class that automatically notifies when the status changes.
// TODO(tim): This class shouldn't be exposed outside of the implementation,
@@ -240,6 +257,9 @@ class ServerConnectionManager {
inline Channel* channel() const { return channel_; }
+ void AddListener(ServerConnectionEventListener* listener);
+ void RemoveListener(ServerConnectionEventListener* listener);
+
inline std::string user_agent() const { return user_agent_; }
inline HttpResponse::ServerConnectionCode server_status() const {
@@ -344,8 +364,12 @@ class ServerConnectionManager {
base::Lock error_count_mutex_; // Protects error_count_
int error_count_; // Tracks the number of connection errors.
+ // TODO(tim): Deprecated.
Channel* const channel_;
+ scoped_refptr<ObserverListThreadSafe<ServerConnectionEventListener> >
+ listeners_;
+
// Volatile so various threads can call server_status() without
// synchronization.
volatile HttpResponse::ServerConnectionCode server_status_;
« no previous file with comments | « chrome/browser/sync/engine/model_safe_worker.cc ('k') | chrome/browser/sync/engine/net/server_connection_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698