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

Side by Side Diff: extensions/browser/api/declarative_webrequest/request_stage.cc

Issue 859993002: Using "static_assert" in lieu of "COMPILE_ASSERT" in extensions 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 | « extensions/browser/api/cast_channel/logger.cc ('k') | extensions/browser/warning_set.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 #include "extensions/browser/api/declarative_webrequest/request_stage.h" 5 #include "extensions/browser/api/declarative_webrequest/request_stage.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 8
9 namespace extensions { 9 namespace extensions {
10 10
11 const unsigned int kActiveStages = ON_BEFORE_REQUEST | 11 const unsigned int kActiveStages = ON_BEFORE_REQUEST |
12 ON_BEFORE_SEND_HEADERS | 12 ON_BEFORE_SEND_HEADERS |
13 ON_HEADERS_RECEIVED | 13 ON_HEADERS_RECEIVED |
14 ON_AUTH_REQUIRED; 14 ON_AUTH_REQUIRED;
15 15
16 // HighestBit<n> computes the highest bit of |n| in compile time, provided that 16 // HighestBit<n> computes the highest bit of |n| in compile time, provided that
17 // |n| is a positive compile-time constant. 17 // |n| is a positive compile-time constant.
18 template <long unsigned int n> 18 template <long unsigned int n>
19 struct HighestBit { 19 struct HighestBit {
20 COMPILE_ASSERT(n > 0, argument_is_not_a_positive_compile_time_constant); 20 static_assert(n > 0, "argument is not a positive compile time constant");
21 enum { VALUE = HighestBit<(n >> 1)>::VALUE << 1 }; 21 enum { VALUE = HighestBit<(n >> 1)>::VALUE << 1 };
22 }; 22 };
23 template <> 23 template <>
24 struct HighestBit<1> { 24 struct HighestBit<1> {
25 enum { VALUE = 1 }; 25 enum { VALUE = 1 };
26 }; 26 };
27 27
28 const unsigned int kLastActiveStage = HighestBit<kActiveStages>::VALUE; 28 const unsigned int kLastActiveStage = HighestBit<kActiveStages>::VALUE;
29 29
30 } // namespace extensions 30 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/cast_channel/logger.cc ('k') | extensions/browser/warning_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698