| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/push_messaging/push_messaging_service_impl.h" | 5 #include "chrome/browser/push_messaging/push_messaging_service_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/barrier_closure.h" | 9 #include "base/barrier_closure.h" |
| 10 #include "base/base64url.h" | 10 #include "base/base64url.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 void PushMessagingServiceImpl::ShutdownHandler() { | 188 void PushMessagingServiceImpl::ShutdownHandler() { |
| 189 // Shutdown() should come before and it removes us from the list of app | 189 // Shutdown() should come before and it removes us from the list of app |
| 190 // handlers of gcm::GCMDriver so this shouldn't ever been called. | 190 // handlers of gcm::GCMDriver so this shouldn't ever been called. |
| 191 NOTREACHED(); | 191 NOTREACHED(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 // OnMessage methods ----------------------------------------------------------- | 194 // OnMessage methods ----------------------------------------------------------- |
| 195 | 195 |
| 196 void PushMessagingServiceImpl::OnMessage(const std::string& app_id, | 196 void PushMessagingServiceImpl::OnMessage(const std::string& app_id, |
| 197 const gcm::IncomingMessage& message) { | 197 const gcm::IncomingMessage& message) { |
| 198 // We won't have time to process and act on the message. |
| 199 // TODO(peter) This should be checked at the level of the GCMDriver, so that |
| 200 // the message is not consumed. See https://crbug.com/612815 |
| 201 if (g_browser_process->IsShuttingDown()) |
| 202 return; |
| 203 |
| 198 in_flight_message_deliveries_.insert(app_id); | 204 in_flight_message_deliveries_.insert(app_id); |
| 199 | 205 |
| 200 #if BUILDFLAG(ENABLE_BACKGROUND) | 206 #if BUILDFLAG(ENABLE_BACKGROUND) |
| 201 if (!in_flight_keep_alive_) { | 207 if (!in_flight_keep_alive_) { |
| 202 in_flight_keep_alive_.reset( | 208 in_flight_keep_alive_.reset( |
| 203 new ScopedKeepAlive(KeepAliveOrigin::IN_FLIGHT_PUSH_MESSAGE, | 209 new ScopedKeepAlive(KeepAliveOrigin::IN_FLIGHT_PUSH_MESSAGE, |
| 204 KeepAliveRestartOption::DISABLED)); | 210 KeepAliveRestartOption::DISABLED)); |
| 205 } | 211 } |
| 206 #endif | 212 #endif |
| 207 | 213 |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 blink::WebPushPermissionStatusGranted; | 798 blink::WebPushPermissionStatusGranted; |
| 793 } | 799 } |
| 794 | 800 |
| 795 gcm::GCMDriver* PushMessagingServiceImpl::GetGCMDriver() const { | 801 gcm::GCMDriver* PushMessagingServiceImpl::GetGCMDriver() const { |
| 796 gcm::GCMProfileService* gcm_profile_service = | 802 gcm::GCMProfileService* gcm_profile_service = |
| 797 gcm::GCMProfileServiceFactory::GetForProfile(profile_); | 803 gcm::GCMProfileServiceFactory::GetForProfile(profile_); |
| 798 CHECK(gcm_profile_service); | 804 CHECK(gcm_profile_service); |
| 799 CHECK(gcm_profile_service->driver()); | 805 CHECK(gcm_profile_service->driver()); |
| 800 return gcm_profile_service->driver(); | 806 return gcm_profile_service->driver(); |
| 801 } | 807 } |
| OLD | NEW |