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

Side by Side Diff: net/ssl/ssl_connection_status_flags.h

Issue 826973002: replace COMPILE_ASSERT with static_assert in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: apply fixups 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 | « net/spdy/spdy_session.h ('k') | net/test/url_request/url_request_mock_http_job.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_ 5 #ifndef NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_
6 #define NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_ 6 #define NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 SSL_CONNECTION_VERSION_UNKNOWN = 0, // Unknown SSL version. 42 SSL_CONNECTION_VERSION_UNKNOWN = 0, // Unknown SSL version.
43 SSL_CONNECTION_VERSION_SSL2 = 1, 43 SSL_CONNECTION_VERSION_SSL2 = 1,
44 SSL_CONNECTION_VERSION_SSL3 = 2, 44 SSL_CONNECTION_VERSION_SSL3 = 2,
45 SSL_CONNECTION_VERSION_TLS1 = 3, 45 SSL_CONNECTION_VERSION_TLS1 = 3,
46 SSL_CONNECTION_VERSION_TLS1_1 = 4, 46 SSL_CONNECTION_VERSION_TLS1_1 = 4,
47 SSL_CONNECTION_VERSION_TLS1_2 = 5, 47 SSL_CONNECTION_VERSION_TLS1_2 = 5,
48 // Reserve 6 for TLS 1.3. 48 // Reserve 6 for TLS 1.3.
49 SSL_CONNECTION_VERSION_QUIC = 7, 49 SSL_CONNECTION_VERSION_QUIC = 7,
50 SSL_CONNECTION_VERSION_MAX, 50 SSL_CONNECTION_VERSION_MAX,
51 }; 51 };
52 COMPILE_ASSERT(SSL_CONNECTION_VERSION_MAX - 1 <= SSL_CONNECTION_VERSION_MASK, 52 static_assert(SSL_CONNECTION_VERSION_MAX - 1 <= SSL_CONNECTION_VERSION_MASK,
53 SSL_CONNECTION_VERSION_MASK_too_small); 53 "SSL_CONNECTION_VERSION_MASK too small");
54 54
55 inline uint16 SSLConnectionStatusToCipherSuite(int connection_status) { 55 inline uint16 SSLConnectionStatusToCipherSuite(int connection_status) {
56 return static_cast<uint16>(connection_status); 56 return static_cast<uint16>(connection_status);
57 } 57 }
58 58
59 inline int SSLConnectionStatusToVersion(int connection_status) { 59 inline int SSLConnectionStatusToVersion(int connection_status) {
60 return (connection_status >> SSL_CONNECTION_VERSION_SHIFT) & 60 return (connection_status >> SSL_CONNECTION_VERSION_SHIFT) &
61 SSL_CONNECTION_VERSION_MASK; 61 SSL_CONNECTION_VERSION_MASK;
62 } 62 }
63 63
(...skipping 13 matching lines...) Expand all
77 *connection_status &= 77 *connection_status &=
78 ~(SSL_CONNECTION_VERSION_MASK << SSL_CONNECTION_VERSION_SHIFT); 78 ~(SSL_CONNECTION_VERSION_MASK << SSL_CONNECTION_VERSION_SHIFT);
79 // Set the new version. 79 // Set the new version.
80 *connection_status |= 80 *connection_status |=
81 ((version & SSL_CONNECTION_VERSION_MASK) << SSL_CONNECTION_VERSION_SHIFT); 81 ((version & SSL_CONNECTION_VERSION_MASK) << SSL_CONNECTION_VERSION_SHIFT);
82 } 82 }
83 83
84 } // namespace net 84 } // namespace net
85 85
86 #endif // NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_ 86 #endif // NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/test/url_request/url_request_mock_http_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698