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

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

Issue 1846913009: HeapSupplements are now just Supplements. (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/ScreenScreenOrientation.h" 5 #include "modules/screen_orientation/ScreenScreenOrientation.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/ScriptState.h"
8 #include "core/frame/Screen.h" 8 #include "core/frame/Screen.h"
9 #include "modules/screen_orientation/ScreenOrientation.h" 9 #include "modules/screen_orientation/ScreenOrientation.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 // static 13 // static
14 ScreenScreenOrientation& ScreenScreenOrientation::from(Screen& screen) 14 ScreenScreenOrientation& ScreenScreenOrientation::from(Screen& screen)
15 { 15 {
16 ScreenScreenOrientation* supplement = static_cast<ScreenScreenOrientation*>( HeapSupplement<Screen>::from(screen, supplementName())); 16 ScreenScreenOrientation* supplement = static_cast<ScreenScreenOrientation*>( Supplement<Screen>::from(screen, supplementName()));
17 if (!supplement) { 17 if (!supplement) {
18 supplement = new ScreenScreenOrientation(); 18 supplement = new ScreenScreenOrientation();
19 provideTo(screen, supplementName(), supplement); 19 provideTo(screen, supplementName(), supplement);
20 } 20 }
21 return *supplement; 21 return *supplement;
22 } 22 }
23 23
24 // static 24 // static
25 ScreenOrientation* ScreenScreenOrientation::orientation(ScriptState* state, Scre en& screen) 25 ScreenOrientation* ScreenScreenOrientation::orientation(ScriptState* state, Scre en& screen)
26 { 26 {
27 ScreenScreenOrientation& self = ScreenScreenOrientation::from(screen); 27 ScreenScreenOrientation& self = ScreenScreenOrientation::from(screen);
28 if (!screen.frame()) 28 if (!screen.frame())
29 return nullptr; 29 return nullptr;
30 30
31 if (!self.m_orientation) 31 if (!self.m_orientation)
32 self.m_orientation = ScreenOrientation::create(screen.frame()); 32 self.m_orientation = ScreenOrientation::create(screen.frame());
33 33
34 return self.m_orientation; 34 return self.m_orientation;
35 } 35 }
36 36
37 const char* ScreenScreenOrientation::supplementName() 37 const char* ScreenScreenOrientation::supplementName()
38 { 38 {
39 return "ScreenScreenOrientation"; 39 return "ScreenScreenOrientation";
40 } 40 }
41 41
42 DEFINE_TRACE(ScreenScreenOrientation) 42 DEFINE_TRACE(ScreenScreenOrientation)
43 { 43 {
44 visitor->trace(m_orientation); 44 visitor->trace(m_orientation);
45 HeapSupplement<Screen>::trace(visitor); 45 Supplement<Screen>::trace(visitor);
46 } 46 }
47 47
48 } // namespace blink 48 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698