Commit 4f175c09 authored by haraken's avatar haraken Committed by Commit bot

Use a new Supplement constructor in ScreenOrientationController

We're deprecating the default constructor of Supplement.

This CL also moves GarbageCollectedFinalized up to ScreenOrientationController.

BUG=610176

Review-Url: https://codereview.chromium.org/2625043002
Cr-Commit-Position: refs/heads/master@{#442892}
parent 8f8b27e9
......@@ -6,6 +6,9 @@
namespace blink {
ScreenOrientationController::ScreenOrientationController(LocalFrame& frame)
: Supplement<LocalFrame>(frame) {}
// static
ScreenOrientationController* ScreenOrientationController::from(
LocalFrame& frame) {
......
......@@ -19,7 +19,11 @@ class WebLockOrientationCallback;
// module will implement and add a provider for.
// Callers of ScreenOrientationController::from() should always assume the
// returned pointer can be nullptr.
class CORE_EXPORT ScreenOrientationController : public Supplement<LocalFrame> {
class CORE_EXPORT ScreenOrientationController
: public GarbageCollectedFinalized<ScreenOrientationController>,
public Supplement<LocalFrame> {
USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationController);
public:
virtual ~ScreenOrientationController() = default;
......@@ -38,6 +42,7 @@ class CORE_EXPORT ScreenOrientationController : public Supplement<LocalFrame> {
DECLARE_VIRTUAL_TRACE();
protected:
explicit ScreenOrientationController(LocalFrame&);
// To be called by an ScreenOrientationController to register its
// implementation.
static void provideTo(LocalFrame&, ScreenOrientationController*);
......
......@@ -92,15 +92,13 @@ class StubFrameLoaderClient : public EmptyFrameLoaderClient {
};
class MockScreenOrientationController final
: public GarbageCollectedFinalized<MockScreenOrientationController>,
public ScreenOrientationController {
USING_GARBAGE_COLLECTED_MIXIN(MockScreenOrientationController);
: public ScreenOrientationController {
WTF_MAKE_NONCOPYABLE(MockScreenOrientationController);
public:
static MockScreenOrientationController* provideTo(LocalFrame& frame) {
MockScreenOrientationController* controller =
new MockScreenOrientationController();
new MockScreenOrientationController(frame);
ScreenOrientationController::provideTo(frame, controller);
return controller;
}
......@@ -108,10 +106,11 @@ class MockScreenOrientationController final
MOCK_METHOD1(lock, void(WebScreenOrientationLockType));
MOCK_METHOD0(mockUnlock, void());
DEFINE_INLINE_VIRTUAL_TRACE() { Supplement<LocalFrame>::trace(visitor); }
DEFINE_INLINE_VIRTUAL_TRACE() { ScreenOrientationController::trace(visitor); }
private:
MockScreenOrientationController() = default;
explicit MockScreenOrientationController(LocalFrame& frame)
: ScreenOrientationController(frame) {}
void lock(WebScreenOrientationLockType type,
std::unique_ptr<WebLockOrientationCallback>) override {
......
......@@ -40,7 +40,8 @@ ScreenOrientationControllerImpl* ScreenOrientationControllerImpl::from(
ScreenOrientationControllerImpl::ScreenOrientationControllerImpl(
LocalFrame& frame,
WebScreenOrientationClient* client)
: ContextLifecycleObserver(frame.document()),
: ScreenOrientationController(frame),
ContextLifecycleObserver(frame.document()),
PlatformEventController(frame.page()),
m_client(client),
m_dispatchEventTimer(
......
......@@ -21,8 +21,7 @@ class ScreenOrientation;
class WebScreenOrientationClient;
class MODULES_EXPORT ScreenOrientationControllerImpl final
: public GarbageCollectedFinalized<ScreenOrientationControllerImpl>,
public ScreenOrientationController,
: public ScreenOrientationController,
public ContextLifecycleObserver,
public PlatformEventController {
USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationControllerImpl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment