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

Side by Side Diff: google_apis/gcm/base/mcs_util.cc

Issue 860983003: Adding "static_assert" in lieu of "COMPILE_ASSERT" in google_apis module (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | google_apis/gcm/base/mcs_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "google_apis/gcm/base/mcs_util.h" 5 #include "google_apis/gcm/base/mcs_util.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 18 matching lines...) Expand all
29 "mcs_proto.IqStanza", 29 "mcs_proto.IqStanza",
30 "mcs_proto.DataMessageStanza", 30 "mcs_proto.DataMessageStanza",
31 "mcs_proto.BatchPresenceStanza", 31 "mcs_proto.BatchPresenceStanza",
32 "mcs_proto.StreamErrorStanza", 32 "mcs_proto.StreamErrorStanza",
33 "mcs_proto.HttpRequest", 33 "mcs_proto.HttpRequest",
34 "mcs_proto.HttpResponse", 34 "mcs_proto.HttpResponse",
35 "mcs_proto.BindAccountRequest", 35 "mcs_proto.BindAccountRequest",
36 "mcs_proto.BindAccountResponse", 36 "mcs_proto.BindAccountResponse",
37 "mcs_proto.TalkMetadata" 37 "mcs_proto.TalkMetadata"
38 }; 38 };
39 COMPILE_ASSERT(arraysize(kProtoNames) == kNumProtoTypes, 39 static_assert(arraysize(kProtoNames) == kNumProtoTypes,
40 ProtoNamesMustIncludeAllTags); 40 "Proto Names Must Include All Tags");
41 41
42 const char kLoginId[] = "chrome-"; 42 const char kLoginId[] = "chrome-";
43 const char kLoginDomain[] = "mcs.android.com"; 43 const char kLoginDomain[] = "mcs.android.com";
44 const char kLoginDeviceIdPrefix[] = "android-"; 44 const char kLoginDeviceIdPrefix[] = "android-";
45 const char kLoginSettingDefaultName[] = "new_vc"; 45 const char kLoginSettingDefaultName[] = "new_vc";
46 const char kLoginSettingDefaultValue[] = "1"; 46 const char kLoginSettingDefaultValue[] = "1";
47 47
48 // Maximum amount of time to save an unsent outgoing message for. 48 // Maximum amount of time to save an unsent outgoing message for.
49 const int kMaxTTLSeconds = 24 * 60 * 60; // 1 day. 49 const int kMaxTTLSeconds = 24 * 60 * 60; // 1 day.
50 50
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 return 0; 253 return 0;
254 const mcs_proto::DataMessageStanza* data_message = 254 const mcs_proto::DataMessageStanza* data_message =
255 reinterpret_cast<const mcs_proto::DataMessageStanza*>(&protobuf); 255 reinterpret_cast<const mcs_proto::DataMessageStanza*>(&protobuf);
256 if (!data_message->has_ttl()) 256 if (!data_message->has_ttl())
257 return kMaxTTLSeconds; 257 return kMaxTTLSeconds;
258 DCHECK_LE(data_message->ttl(), kMaxTTLSeconds); 258 DCHECK_LE(data_message->ttl(), kMaxTTLSeconds);
259 return data_message->ttl(); 259 return data_message->ttl();
260 } 260 }
261 261
262 } // namespace gcm 262 } // namespace gcm
OLDNEW
« no previous file with comments | « no previous file | google_apis/gcm/base/mcs_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698