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

Unified Diff: components/gcm_driver/gcm_driver_desktop.cc

Issue 2578583002: Provide a mechanism for the GCM driver to send message receipts to GCM.
Patch Set: Created 4 years 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: components/gcm_driver/gcm_driver_desktop.cc
diff --git a/components/gcm_driver/gcm_driver_desktop.cc b/components/gcm_driver/gcm_driver_desktop.cc
index 599957d2a5979fced996c2440031f4cee4344b7c..6408981e2b7d179d1df6d263fd5a0a03fff330a8 100644
--- a/components/gcm_driver/gcm_driver_desktop.cc
+++ b/components/gcm_driver/gcm_driver_desktop.cc
@@ -55,6 +55,9 @@ class GCMDriverDesktop::IOWorker : public GCMClient::Delegate {
GCMClient::Result result) override;
void OnMessageReceived(const std::string& app_id,
const IncomingMessage& message) override;
+ void OnMessageReceivedError(const std::string& app_id,
+ const std::string& message_id,
+ int status) override;
void OnMessagesDeleted(const std::string& app_id) override;
void OnMessageSendError(
const std::string& app_id,
@@ -244,6 +247,17 @@ void GCMDriverDesktop::IOWorker::OnMessageReceived(
message));
}
+void GCMDriverDesktop::IOWorker::OnMessageReceivedError(
+ const std::string& app_id,
+ const std::string& message_id,
+ int status) {
+ DCHECK(io_thread_->RunsTasksOnCurrentThread());
+
+ ui_thread_->PostTask(
+ FROM_HERE, base::Bind(&GCMDriverDesktop::MessageReceivedError, service_,
+ app_id, message_id, status));
+}
+
void GCMDriverDesktop::IOWorker::OnMessagesDeleted(const std::string& app_id) {
DCHECK(io_thread_->RunsTasksOnCurrentThread());
@@ -1226,6 +1240,18 @@ void GCMDriverDesktop::MessageReceived(const std::string& app_id,
DispatchMessage(app_id, message);
}
+void GCMDriverDesktop::MessageReceivedError(const std::string& app_id,
+ const std::string& message_id,
+ int status) {
+ DCHECK(ui_thread_->RunsTasksOnCurrentThread());
+
+ // Drop the event if the service has been stopped.
+ if (!gcm_started_)
+ return;
+
+ SendMessageReceipt(app_id, message_id, status);
+}
+
void GCMDriverDesktop::MessagesDeleted(const std::string& app_id) {
DCHECK(ui_thread_->RunsTasksOnCurrentThread());
« components/gcm_driver/gcm_driver.cc ('K') | « components/gcm_driver/gcm_driver_desktop.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698