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

Side by Side Diff: components/gcm_driver/gcm_client_impl.cc

Issue 1548113002: Switch to standard integer types in components/, part 2 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn Created 4 years, 11 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 unified diff | Download patch
OLDNEW
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 "components/gcm_driver/gcm_client_impl.h" 5 #include "components/gcm_driver/gcm_client_impl.h"
6 6
7 #include <stddef.h>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
9 #include "base/location.h" 11 #include "base/location.h"
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
12 #include "base/metrics/histogram_macros.h" 14 #include "base/metrics/histogram_macros.h"
13 #include "base/sequenced_task_runner.h" 15 #include "base/sequenced_task_runner.h"
14 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
15 #include "base/stl_util.h" 17 #include "base/stl_util.h"
16 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 77
76 const char kGCMScope[] = "GCM"; 78 const char kGCMScope[] = "GCM";
77 const int kMaxRegistrationRetries = 5; 79 const int kMaxRegistrationRetries = 5;
78 const int kMaxUnregistrationRetries = 5; 80 const int kMaxUnregistrationRetries = 5;
79 const char kMessageTypeDataMessage[] = "gcm"; 81 const char kMessageTypeDataMessage[] = "gcm";
80 const char kMessageTypeDeletedMessagesKey[] = "deleted_messages"; 82 const char kMessageTypeDeletedMessagesKey[] = "deleted_messages";
81 const char kMessageTypeKey[] = "message_type"; 83 const char kMessageTypeKey[] = "message_type";
82 const char kMessageTypeSendErrorKey[] = "send_error"; 84 const char kMessageTypeSendErrorKey[] = "send_error";
83 const char kSendErrorMessageIdKey[] = "google.message_id"; 85 const char kSendErrorMessageIdKey[] = "google.message_id";
84 const char kSendMessageFromValue[] = "gcm@chrome.com"; 86 const char kSendMessageFromValue[] = "gcm@chrome.com";
85 const int64 kDefaultUserSerialNumber = 0LL; 87 const int64_t kDefaultUserSerialNumber = 0LL;
86 const int kDestroyGCMStoreDelayMS = 5 * 60 * 1000; // 5 minutes. 88 const int kDestroyGCMStoreDelayMS = 5 * 60 * 1000; // 5 minutes.
87 89
88 GCMClient::Result ToGCMClientResult(MCSClient::MessageSendStatus status) { 90 GCMClient::Result ToGCMClientResult(MCSClient::MessageSendStatus status) {
89 switch (status) { 91 switch (status) {
90 case MCSClient::QUEUED: 92 case MCSClient::QUEUED:
91 return GCMClient::SUCCESS; 93 return GCMClient::SUCCESS;
92 case MCSClient::QUEUE_SIZE_LIMIT_REACHED: 94 case MCSClient::QUEUE_SIZE_LIMIT_REACHED:
93 return GCMClient::NETWORK_ERROR; 95 return GCMClient::NETWORK_ERROR;
94 case MCSClient::APP_QUEUE_SIZE_LIMIT_REACHED: 96 case MCSClient::APP_QUEUE_SIZE_LIMIT_REACHED:
95 return GCMClient::NETWORK_ERROR; 97 return GCMClient::NETWORK_ERROR;
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 case kDataMessageStanzaTag: 1210 case kDataMessageStanzaTag:
1209 DVLOG(1) << "A downstream message received. Processing..."; 1211 DVLOG(1) << "A downstream message received. Processing...";
1210 HandleIncomingMessage(message); 1212 HandleIncomingMessage(message);
1211 return; 1213 return;
1212 default: 1214 default:
1213 NOTREACHED() << "Message with unexpected tag received by GCMClient"; 1215 NOTREACHED() << "Message with unexpected tag received by GCMClient";
1214 return; 1216 return;
1215 } 1217 }
1216 } 1218 }
1217 1219
1218 void GCMClientImpl::OnMessageSentToMCS(int64 user_serial_number, 1220 void GCMClientImpl::OnMessageSentToMCS(int64_t user_serial_number,
1219 const std::string& app_id, 1221 const std::string& app_id,
1220 const std::string& message_id, 1222 const std::string& message_id,
1221 MCSClient::MessageSendStatus status) { 1223 MCSClient::MessageSendStatus status) {
1222 DCHECK_EQ(user_serial_number, kDefaultUserSerialNumber); 1224 DCHECK_EQ(user_serial_number, kDefaultUserSerialNumber);
1223 DCHECK(delegate_); 1225 DCHECK(delegate_);
1224 1226
1225 // TTL_EXCEEDED is singled out here, because it can happen long time after the 1227 // TTL_EXCEEDED is singled out here, because it can happen long time after the
1226 // message was sent. That is why it comes as |OnMessageSendError| event rather 1228 // message was sent. That is why it comes as |OnMessageSendError| event rather
1227 // than |OnSendFinished|. SendErrorDetails.additional_data is left empty. 1229 // than |OnSendFinished|. SendErrorDetails.additional_data is left empty.
1228 // All other errors will be raised immediately, through asynchronous callback. 1230 // All other errors will be raised immediately, through asynchronous callback.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 bool GCMClientImpl::HasStandaloneRegisteredApp() const { 1375 bool GCMClientImpl::HasStandaloneRegisteredApp() const {
1374 if (registrations_.empty()) 1376 if (registrations_.empty())
1375 return false; 1377 return false;
1376 // Note that account mapper is not counted as a standalone app since it is 1378 // Note that account mapper is not counted as a standalone app since it is
1377 // automatically started when other app uses GCM. 1379 // automatically started when other app uses GCM.
1378 return registrations_.size() > 1 || 1380 return registrations_.size() > 1 ||
1379 !ExistsGCMRegistrationInMap(registrations_, kGCMAccountMapperAppId); 1381 !ExistsGCMRegistrationInMap(registrations_, kGCMAccountMapperAppId);
1380 } 1382 }
1381 1383
1382 } // namespace gcm 1384 } // namespace gcm
OLDNEW
« no previous file with comments | « components/gcm_driver/gcm_client_impl.h ('k') | components/gcm_driver/gcm_client_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698