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

Side by Side Diff: content/child/assert_matching_enums.cc

Issue 1676703002: Stop using macros to paste together names for static_asserts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: static-asserts-enums: a,b,#a Created 4 years, 10 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 | « content/child/appcache/appcache_frontend_impl.cc ('k') | content/child/web_url_request_util.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 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 // Use this file to assert that *_list.h enums that are meant to do the bridge 5 // Use this file to assert that *_list.h enums that are meant to do the bridge
6 // from Blink are valid. 6 // from Blink are valid.
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "cc/animation/animation.h" 9 #include "cc/animation/animation.h"
10 #include "content/public/common/screen_orientation_values.h" 10 #include "content/public/common/screen_orientation_values.h"
11 #include "media/base/mime_util.h" 11 #include "media/base/mime_util.h"
12 #include "third_party/WebKit/public/platform/WebCompositorAnimation.h" 12 #include "third_party/WebKit/public/platform/WebCompositorAnimation.h"
13 #include "third_party/WebKit/public/platform/WebMimeRegistry.h" 13 #include "third_party/WebKit/public/platform/WebMimeRegistry.h"
14 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h" 14 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 #define STATIC_ASSERT_MATCHING_ENUM(expected, actual) \ 18 #define STATIC_ASSERT_ENUM(a, b) \
19 static_assert(int(expected) == int(actual), "mismatching enums: " #expected) 19 static_assert(static_cast<int>(a) == static_cast<int>(b), \
20 "mismatching enums: " #a)
20 21
21 // ScreenOrientationValues 22 // ScreenOrientationValues
22 STATIC_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockDefault, 23 STATIC_ASSERT_ENUM(blink::WebScreenOrientationLockDefault,
23 SCREEN_ORIENTATION_VALUES_DEFAULT); 24 SCREEN_ORIENTATION_VALUES_DEFAULT);
24 STATIC_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockPortraitPrimary, 25 STATIC_ASSERT_ENUM(blink::WebScreenOrientationLockPortraitPrimary,
25 SCREEN_ORIENTATION_VALUES_PORTRAIT_PRIMARY); 26 SCREEN_ORIENTATION_VALUES_PORTRAIT_PRIMARY);
26 STATIC_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockPortraitSecondary, 27 STATIC_ASSERT_ENUM(blink::WebScreenOrientationLockPortraitSecondary,
27 SCREEN_ORIENTATION_VALUES_PORTRAIT_SECONDARY); 28 SCREEN_ORIENTATION_VALUES_PORTRAIT_SECONDARY);
28 STATIC_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockLandscapePrimary, 29 STATIC_ASSERT_ENUM(blink::WebScreenOrientationLockLandscapePrimary,
29 SCREEN_ORIENTATION_VALUES_LANDSCAPE_PRIMARY); 30 SCREEN_ORIENTATION_VALUES_LANDSCAPE_PRIMARY);
30 STATIC_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockLandscapeSecondary, 31 STATIC_ASSERT_ENUM(blink::WebScreenOrientationLockLandscapeSecondary,
31 SCREEN_ORIENTATION_VALUES_LANDSCAPE_SECONDARY); 32 SCREEN_ORIENTATION_VALUES_LANDSCAPE_SECONDARY);
32 STATIC_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockAny, 33 STATIC_ASSERT_ENUM(blink::WebScreenOrientationLockAny,
33 SCREEN_ORIENTATION_VALUES_ANY); 34 SCREEN_ORIENTATION_VALUES_ANY);
34 STATIC_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockLandscape, 35 STATIC_ASSERT_ENUM(blink::WebScreenOrientationLockLandscape,
35 SCREEN_ORIENTATION_VALUES_LANDSCAPE); 36 SCREEN_ORIENTATION_VALUES_LANDSCAPE);
36 STATIC_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockPortrait, 37 STATIC_ASSERT_ENUM(blink::WebScreenOrientationLockPortrait,
37 SCREEN_ORIENTATION_VALUES_PORTRAIT); 38 SCREEN_ORIENTATION_VALUES_PORTRAIT);
38 STATIC_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockNatural, 39 STATIC_ASSERT_ENUM(blink::WebScreenOrientationLockNatural,
39 SCREEN_ORIENTATION_VALUES_NATURAL); 40 SCREEN_ORIENTATION_VALUES_NATURAL);
40 41
41 // SupportsType 42 // SupportsType
42 STATIC_ASSERT_MATCHING_ENUM(blink::WebMimeRegistry::IsNotSupported, 43 STATIC_ASSERT_ENUM(blink::WebMimeRegistry::IsNotSupported,
43 media::IsNotSupported); 44 media::IsNotSupported);
44 STATIC_ASSERT_MATCHING_ENUM(blink::WebMimeRegistry::IsSupported, 45 STATIC_ASSERT_ENUM(blink::WebMimeRegistry::IsSupported, media::IsSupported);
45 media::IsSupported); 46 STATIC_ASSERT_ENUM(blink::WebMimeRegistry::MayBeSupported,
46 STATIC_ASSERT_MATCHING_ENUM(blink::WebMimeRegistry::MayBeSupported, 47 media::MayBeSupported);
47 media::MayBeSupported);
48 48
49 // TargetProperty 49 // TargetProperty
50 STATIC_ASSERT_MATCHING_ENUM( 50 STATIC_ASSERT_ENUM(blink::WebCompositorAnimation::TargetPropertyTransform,
51 blink::WebCompositorAnimation::TargetPropertyTransform, 51 cc::Animation::TRANSFORM);
52 cc::Animation::TRANSFORM); 52 STATIC_ASSERT_ENUM(blink::WebCompositorAnimation::TargetPropertyOpacity,
53 STATIC_ASSERT_MATCHING_ENUM( 53 cc::Animation::OPACITY);
54 blink::WebCompositorAnimation::TargetPropertyOpacity, 54 STATIC_ASSERT_ENUM(blink::WebCompositorAnimation::TargetPropertyFilter,
55 cc::Animation::OPACITY); 55 cc::Animation::FILTER);
56 STATIC_ASSERT_MATCHING_ENUM(blink::WebCompositorAnimation::TargetPropertyFilter, 56 STATIC_ASSERT_ENUM(blink::WebCompositorAnimation::TargetPropertyScrollOffset,
57 cc::Animation::FILTER); 57 cc::Animation::SCROLL_OFFSET);
58 STATIC_ASSERT_MATCHING_ENUM(
59 blink::WebCompositorAnimation::TargetPropertyScrollOffset,
60 cc::Animation::SCROLL_OFFSET);
61 58
62 } // namespace content 59 } // namespace content
OLDNEW
« no previous file with comments | « content/child/appcache/appcache_frontend_impl.cc ('k') | content/child/web_url_request_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698