Chromium Code Reviews| Index: Source/modules/screen_orientation/ScreenScreenOrientation.cpp |
| diff --git a/Source/modules/screen_orientation/ScreenScreenOrientation.cpp b/Source/modules/screen_orientation/ScreenScreenOrientation.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..db7537e20e9b3b2e800859bb5a078a4517b3460b |
| --- /dev/null |
| +++ b/Source/modules/screen_orientation/ScreenScreenOrientation.cpp |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "config.h" |
| +#include "modules/screen_orientation/ScreenScreenOrientation.h" |
| + |
| +#include "bindings/core/v8/ScriptState.h" |
| +#include "core/frame/Screen.h" |
| +#include "modules/screen_orientation/ScreenOrientation.h" |
| + |
| +namespace WebCore { |
| + |
| +// static |
| +ScreenScreenOrientation& ScreenScreenOrientation::from(Screen& screen) |
| +{ |
| + ScreenScreenOrientation* supplement = static_cast<ScreenScreenOrientation*>(WillBeHeapSupplement<Screen>::from(screen, supplementName())); |
| + if (!supplement) { |
| + supplement = new ScreenScreenOrientation(); |
| + provideTo(screen, supplementName(), adoptPtrWillBeNoop(supplement)); |
| + } |
| + return *supplement; |
| +} |
| + |
| +ScreenScreenOrientation::~ScreenScreenOrientation() |
| +{ |
| +} |
| + |
| +// static |
| +ScreenOrientation* ScreenScreenOrientation::orientation(ScriptState* state, Screen& screen) |
| +{ |
| + ScreenScreenOrientation& self = ScreenScreenOrientation::from(screen); |
| + if (!screen.frame()) |
| + return 0; |
| + |
| + if (!self.m_orientation) |
| + self.m_orientation = ScreenOrientation::create(screen.frame()); |
| + |
| + return self.m_orientation.get(); |
| +} |
| + |
| +const char* ScreenScreenOrientation::supplementName() |
| +{ |
| + return "ScreenScreenOrientation"; |
| +} |
| + |
| +void ScreenScreenOrientation::trace(Visitor* visitor) |
| +{ |
| + m_orientation->trace(visitor); |
|
sof
2014/07/09 19:33:37
Oh, this needs to be visitor->trace(m_orientation)
sof
2014/07/10 05:06:21
It might be worth(re?)considering if the validatio
mlamouri (slow - plz ping)
2014/07/10 09:41:57
Done.
|
| + WillBeHeapSupplement<Screen>::trace(visitor); |
| +} |
| + |
| +} // namespace WebCore |