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

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

Issue 1844223002: Literal AtomicString construction can rely on strlen optimization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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"
(...skipping 15 matching lines...) Expand all
26 26
27 namespace blink { 27 namespace blink {
28 28
29 struct ScreenOrientationInfo { 29 struct ScreenOrientationInfo {
30 const AtomicString& name; 30 const AtomicString& name;
31 unsigned orientation; 31 unsigned orientation;
32 }; 32 };
33 33
34 static ScreenOrientationInfo* orientationsMap(unsigned& length) 34 static ScreenOrientationInfo* orientationsMap(unsigned& length)
35 { 35 {
36 DEFINE_STATIC_LOCAL(const AtomicString, portraitPrimary, ("portrait-primary" , AtomicString::ConstructFromLiteral)); 36 DEFINE_STATIC_LOCAL(const AtomicString, portraitPrimary, ("portrait-primary" ));
37 DEFINE_STATIC_LOCAL(const AtomicString, portraitSecondary, ("portrait-second ary", AtomicString::ConstructFromLiteral)); 37 DEFINE_STATIC_LOCAL(const AtomicString, portraitSecondary, ("portrait-second ary"));
38 DEFINE_STATIC_LOCAL(const AtomicString, landscapePrimary, ("landscape-primar y", AtomicString::ConstructFromLiteral)); 38 DEFINE_STATIC_LOCAL(const AtomicString, landscapePrimary, ("landscape-primar y"));
39 DEFINE_STATIC_LOCAL(const AtomicString, landscapeSecondary, ("landscape-seco ndary", AtomicString::ConstructFromLiteral)); 39 DEFINE_STATIC_LOCAL(const AtomicString, landscapeSecondary, ("landscape-seco ndary"));
40 DEFINE_STATIC_LOCAL(const AtomicString, any, ("any", AtomicString::Construct FromLiteral)); 40 DEFINE_STATIC_LOCAL(const AtomicString, any, ("any"));
41 DEFINE_STATIC_LOCAL(const AtomicString, portrait, ("portrait", AtomicString: :ConstructFromLiteral)); 41 DEFINE_STATIC_LOCAL(const AtomicString, portrait, ("portrait"));
42 DEFINE_STATIC_LOCAL(const AtomicString, landscape, ("landscape", AtomicStrin g::ConstructFromLiteral)); 42 DEFINE_STATIC_LOCAL(const AtomicString, landscape, ("landscape"));
43 DEFINE_STATIC_LOCAL(const AtomicString, natural, ("natural", AtomicString::C onstructFromLiteral)); 43 DEFINE_STATIC_LOCAL(const AtomicString, natural, ("natural"));
44 44
45 static ScreenOrientationInfo orientationMap[] = { 45 static ScreenOrientationInfo orientationMap[] = {
46 { portraitPrimary, WebScreenOrientationLockPortraitPrimary }, 46 { portraitPrimary, WebScreenOrientationLockPortraitPrimary },
47 { portraitSecondary, WebScreenOrientationLockPortraitSecondary }, 47 { portraitSecondary, WebScreenOrientationLockPortraitSecondary },
48 { landscapePrimary, WebScreenOrientationLockLandscapePrimary }, 48 { landscapePrimary, WebScreenOrientationLockLandscapePrimary },
49 { landscapeSecondary, WebScreenOrientationLockLandscapeSecondary }, 49 { landscapeSecondary, WebScreenOrientationLockLandscapeSecondary },
50 { any, WebScreenOrientationLockAny }, 50 { any, WebScreenOrientationLockAny },
51 { portrait, WebScreenOrientationLockPortrait }, 51 { portrait, WebScreenOrientationLockPortrait },
52 { landscape, WebScreenOrientationLockLandscape }, 52 { landscape, WebScreenOrientationLockLandscape },
53 { natural, WebScreenOrientationLockNatural } 53 { natural, WebScreenOrientationLockNatural }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 return ScreenOrientationController::from(*m_frame); 189 return ScreenOrientationController::from(*m_frame);
190 } 190 }
191 191
192 DEFINE_TRACE(ScreenOrientation) 192 DEFINE_TRACE(ScreenOrientation)
193 { 193 {
194 RefCountedGarbageCollectedEventTargetWithInlineData<ScreenOrientation>::trac e(visitor); 194 RefCountedGarbageCollectedEventTargetWithInlineData<ScreenOrientation>::trac e(visitor);
195 DOMWindowProperty::trace(visitor); 195 DOMWindowProperty::trace(visitor);
196 } 196 }
197 197
198 } // namespace blink 198 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698