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

Unified Diff: jingle/notifier/listener/non_blocking_push_client.cc

Issue 11232048: Adding XMPP ping functionality to CLoudPrint. XMPP ping and timeout is controlled thorugh Service S… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments addressed Created 8 years, 2 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: jingle/notifier/listener/non_blocking_push_client.cc
diff --git a/jingle/notifier/listener/non_blocking_push_client.cc b/jingle/notifier/listener/non_blocking_push_client.cc
index 5765d37306817f18894bfb907f94114e030585ff..c42561e685a7dedd4fbe9741d66c9cf04c023f01 100644
--- a/jingle/notifier/listener/non_blocking_push_client.cc
+++ b/jingle/notifier/listener/non_blocking_push_client.cc
@@ -38,12 +38,14 @@ class NonBlockingPushClient::Core
void UpdateSubscriptions(const SubscriptionList& subscriptions);
void UpdateCredentials(const std::string& email, const std::string& token);
void SendNotification(const Notification& data);
+ void SendPing();
virtual void OnNotificationsEnabled() OVERRIDE;
virtual void OnNotificationsDisabled(
NotificationsDisabledReason reason) OVERRIDE;
virtual void OnIncomingNotification(
const Notification& notification) OVERRIDE;
+ virtual void OnPingResponse() OVERRIDE;
private:
friend class base::RefCountedThreadSafe<NonBlockingPushClient::Core>;
@@ -110,6 +112,12 @@ void NonBlockingPushClient::Core::SendNotification(
delegate_push_client_->SendNotification(notification);
}
+void NonBlockingPushClient::Core::SendPing() {
+ DCHECK(delegate_task_runner_->BelongsToCurrentThread());
+ DCHECK(delegate_push_client_.get());
+ delegate_push_client_->SendPing();
+}
+
void NonBlockingPushClient::Core::OnNotificationsEnabled() {
DCHECK(delegate_task_runner_->BelongsToCurrentThread());
parent_task_runner_->PostTask(
@@ -136,6 +144,14 @@ void NonBlockingPushClient::Core::OnIncomingNotification(
parent_push_client_, notification));
}
+void NonBlockingPushClient::Core::OnPingResponse() {
+ DCHECK(delegate_task_runner_->BelongsToCurrentThread());
+ parent_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&NonBlockingPushClient::OnPingResponse,
+ parent_push_client_));
+}
+
NonBlockingPushClient::NonBlockingPushClient(
const scoped_refptr<base::SingleThreadTaskRunner>& delegate_task_runner,
const CreateBlockingPushClientCallback&
@@ -195,6 +211,13 @@ void NonBlockingPushClient::SendNotification(
notification));
}
+void NonBlockingPushClient::SendPing() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ delegate_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&NonBlockingPushClient::Core::SendPing, core_.get()));
+}
+
void NonBlockingPushClient::OnNotificationsEnabled() {
DCHECK(thread_checker_.CalledOnValidThread());
FOR_EACH_OBSERVER(PushClientObserver, observers_,
@@ -215,4 +238,9 @@ void NonBlockingPushClient::OnIncomingNotification(
OnIncomingNotification(notification));
}
+void NonBlockingPushClient::OnPingResponse() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ FOR_EACH_OBSERVER(PushClientObserver, observers_, OnPingResponse());
+}
+
} // namespace notifier
« no previous file with comments | « jingle/notifier/listener/non_blocking_push_client.h ('k') | jingle/notifier/listener/non_blocking_push_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698