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 @@ ...@@ -6,6 +6,9 @@
namespace blink { namespace blink {
ScreenOrientationController::ScreenOrientationController(LocalFrame& frame)
: Supplement<LocalFrame>(frame) {}
// static // static
ScreenOrientationController* ScreenOrientationController::from( ScreenOrientationController* ScreenOrientationController::from(
LocalFrame& frame) { LocalFrame& frame) {
......
...@@ -19,7 +19,11 @@ class WebLockOrientationCallback; ...@@ -19,7 +19,11 @@ class WebLockOrientationCallback;
// module will implement and add a provider for. // module will implement and add a provider for.
// Callers of ScreenOrientationController::from() should always assume the // Callers of ScreenOrientationController::from() should always assume the
// returned pointer can be nullptr. // 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: public:
virtual ~ScreenOrientationController() = default; virtual ~ScreenOrientationController() = default;
...@@ -38,6 +42,7 @@ class CORE_EXPORT ScreenOrientationController : public Supplement<LocalFrame> { ...@@ -38,6 +42,7 @@ class CORE_EXPORT ScreenOrientationController : public Supplement<LocalFrame> {
DECLARE_VIRTUAL_TRACE(); DECLARE_VIRTUAL_TRACE();
protected: protected:
explicit ScreenOrientationController(LocalFrame&);
// To be called by an ScreenOrientationController to register its // To be called by an ScreenOrientationController to register its
// implementation. // implementation.
static void provideTo(LocalFrame&, ScreenOrientationController*); static void provideTo(LocalFrame&, ScreenOrientationController*);
......
...@@ -92,15 +92,13 @@ class StubFrameLoaderClient : public EmptyFrameLoaderClient { ...@@ -92,15 +92,13 @@ class StubFrameLoaderClient : public EmptyFrameLoaderClient {
}; };
class MockScreenOrientationController final class MockScreenOrientationController final
: public GarbageCollectedFinalized<MockScreenOrientationController>, : public ScreenOrientationController {
public ScreenOrientationController {
USING_GARBAGE_COLLECTED_MIXIN(MockScreenOrientationController);
WTF_MAKE_NONCOPYABLE(MockScreenOrientationController); WTF_MAKE_NONCOPYABLE(MockScreenOrientationController);
public: public:
static MockScreenOrientationController* provideTo(LocalFrame& frame) { static MockScreenOrientationController* provideTo(LocalFrame& frame) {
MockScreenOrientationController* controller = MockScreenOrientationController* controller =
new MockScreenOrientationController(); new MockScreenOrientationController(frame);
ScreenOrientationController::provideTo(frame, controller); ScreenOrientationController::provideTo(frame, controller);
return controller; return controller;
} }
...@@ -108,10 +106,11 @@ class MockScreenOrientationController final ...@@ -108,10 +106,11 @@ class MockScreenOrientationController final
MOCK_METHOD1(lock, void(WebScreenOrientationLockType)); MOCK_METHOD1(lock, void(WebScreenOrientationLockType));
MOCK_METHOD0(mockUnlock, void()); MOCK_METHOD0(mockUnlock, void());
DEFINE_INLINE_VIRTUAL_TRACE() { Supplement<LocalFrame>::trace(visitor); } DEFINE_INLINE_VIRTUAL_TRACE() { ScreenOrientationController::trace(visitor); }
private: private:
MockScreenOrientationController() = default; explicit MockScreenOrientationController(LocalFrame& frame)
: ScreenOrientationController(frame) {}
void lock(WebScreenOrientationLockType type, void lock(WebScreenOrientationLockType type,
std::unique_ptr<WebLockOrientationCallback>) override { std::unique_ptr<WebLockOrientationCallback>) override {
......
...@@ -40,7 +40,8 @@ ScreenOrientationControllerImpl* ScreenOrientationControllerImpl::from( ...@@ -40,7 +40,8 @@ ScreenOrientationControllerImpl* ScreenOrientationControllerImpl::from(
ScreenOrientationControllerImpl::ScreenOrientationControllerImpl( ScreenOrientationControllerImpl::ScreenOrientationControllerImpl(
LocalFrame& frame, LocalFrame& frame,
WebScreenOrientationClient* client) WebScreenOrientationClient* client)
: ContextLifecycleObserver(frame.document()), : ScreenOrientationController(frame),
ContextLifecycleObserver(frame.document()),
PlatformEventController(frame.page()), PlatformEventController(frame.page()),
m_client(client), m_client(client),
m_dispatchEventTimer( m_dispatchEventTimer(
......
...@@ -21,8 +21,7 @@ class ScreenOrientation; ...@@ -21,8 +21,7 @@ class ScreenOrientation;
class WebScreenOrientationClient; class WebScreenOrientationClient;
class MODULES_EXPORT ScreenOrientationControllerImpl final class MODULES_EXPORT ScreenOrientationControllerImpl final
: public GarbageCollectedFinalized<ScreenOrientationControllerImpl>, : public ScreenOrientationController,
public ScreenOrientationController,
public ContextLifecycleObserver, public ContextLifecycleObserver,
public PlatformEventController { public PlatformEventController {
USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationControllerImpl); 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