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

Side by Side Diff: third_party/WebKit/Source/modules/screen_orientation/ScreenOrientation.cpp

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
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 "modules/screen_orientation/ScreenOrientation.h" 5 #include "modules/screen_orientation/ScreenOrientation.h"
6 6
7 #include "bindings/core/v8/ScriptPromise.h" 7 #include "bindings/core/v8/ScriptPromise.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "core/dom/DOMException.h" 9 #include "core/dom/DOMException.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
11 #include "core/dom/ExceptionCode.h" 11 #include "core/dom/ExceptionCode.h"
12 #include "core/frame/LocalFrame.h" 12 #include "core/frame/LocalFrame.h"
13 #include "modules/EventTargetModules.h" 13 #include "modules/EventTargetModules.h"
14 #include "modules/screen_orientation/LockOrientationCallback.h" 14 #include "modules/screen_orientation/LockOrientationCallback.h"
15 #include "modules/screen_orientation/ScreenOrientationController.h" 15 #include "modules/screen_orientation/ScreenOrientationController.h"
16 #include "public/platform/modules/screen_orientation/WebScreenOrientationType.h" 16 #include "public/platform/modules/screen_orientation/WebScreenOrientationType.h"
17 17
18 // This code assumes that WebScreenOrientationType values are included in WebScr eenOrientationLockType. 18 // This code assumes that WebScreenOrientationType values are included in WebScr eenOrientationLockType.
19 #define STATIC_ASSERT_MATCHING_ENUM(enum1, enum2) \ 19 #define STATIC_ASSERT_ENUM(a, b) \
20 static_assert(static_cast<unsigned>(blink::enum1) == static_cast<unsigned>(b link::enum2), "mismatching enum values") 20 static_assert(static_cast<int>(a) == static_cast<int>(b), \
21 STATIC_ASSERT_MATCHING_ENUM(WebScreenOrientationPortraitPrimary, WebScreenOrient ationLockPortraitPrimary); 21 "mismatching enum: " #a)
22 STATIC_ASSERT_MATCHING_ENUM(WebScreenOrientationPortraitSecondary, WebScreenOrie ntationLockPortraitSecondary); 22 STATIC_ASSERT_ENUM(blink::WebScreenOrientationPortraitPrimary, blink::WebScreenO rientationLockPortraitPrimary);
23 STATIC_ASSERT_MATCHING_ENUM(WebScreenOrientationLandscapePrimary, WebScreenOrien tationLockLandscapePrimary); 23 STATIC_ASSERT_ENUM(blink::WebScreenOrientationPortraitSecondary, blink::WebScree nOrientationLockPortraitSecondary);
24 STATIC_ASSERT_MATCHING_ENUM(WebScreenOrientationLandscapeSecondary, WebScreenOri entationLockLandscapeSecondary); 24 STATIC_ASSERT_ENUM(blink::WebScreenOrientationLandscapePrimary, blink::WebScreen OrientationLockLandscapePrimary);
25 STATIC_ASSERT_ENUM(blink::WebScreenOrientationLandscapeSecondary, blink::WebScre enOrientationLockLandscapeSecondary);
25 26
26 namespace blink { 27 namespace blink {
27 28
28 struct ScreenOrientationInfo { 29 struct ScreenOrientationInfo {
29 const AtomicString& name; 30 const AtomicString& name;
30 unsigned orientation; 31 unsigned orientation;
31 }; 32 };
32 33
33 static ScreenOrientationInfo* orientationsMap(unsigned& length) 34 static ScreenOrientationInfo* orientationsMap(unsigned& length)
34 { 35 {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 return ScreenOrientationController::from(*m_frame); 189 return ScreenOrientationController::from(*m_frame);
189 } 190 }
190 191
191 DEFINE_TRACE(ScreenOrientation) 192 DEFINE_TRACE(ScreenOrientation)
192 { 193 {
193 RefCountedGarbageCollectedEventTargetWithInlineData<ScreenOrientation>::trac e(visitor); 194 RefCountedGarbageCollectedEventTargetWithInlineData<ScreenOrientation>::trac e(visitor);
194 DOMWindowProperty::trace(visitor); 195 DOMWindowProperty::trace(visitor);
195 } 196 }
196 197
197 } // namespace blink 198 } // namespace blink
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_text_input_thunk.cc ('k') | third_party/WebKit/Source/web/AssertMatchingEnums.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698