Title: [133028] trunk/Source
Revision
133028
Author
[email protected]
Date
2012-10-31 07:59:59 -0700 (Wed, 31 Oct 2012)

Log Message

Unreviewed, rolling out r133016.
http://trac.webkit.org/changeset/133016
https://bugs.webkit.org/show_bug.cgi?id=100856

broke compile-webkit on several bots (Requested by podivilov
on #webkit).

Patch by Sheriff Bot <[email protected]> on 2012-10-31

Source/WebCore:

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* dom/DeviceOrientationClient.h:
(DeviceOrientationClient):
* dom/DeviceOrientationController.cpp:
(WebCore::DeviceOrientationController::DeviceOrientationController):
(WebCore):
(WebCore::DeviceOrientationController::~DeviceOrientationController):
(WebCore::DeviceOrientationController::timerFired):
(WebCore::DeviceOrientationController::addListener):
(WebCore::DeviceOrientationController::removeListener):
(WebCore::DeviceOrientationController::removeAllListeners):
(WebCore::DeviceOrientationController::suspendEventsForAllListeners):
(WebCore::DeviceOrientationController::resumeEventsForAllListeners):
(WebCore::DeviceOrientationController::didChangeDeviceOrientation):
(WebCore::DeviceOrientationController::supplementName):
* dom/DeviceOrientationController.h:
(WebCore):
(DeviceOrientationController):
(WebCore::DeviceOrientationController::isActive):
(WebCore::DeviceOrientationController::client):
(WebCore::DeviceOrientationController::from):
* dom/Document.cpp:
(WebCore::Document::suspendActiveDOMObjects):
(WebCore::Document::resumeActiveDOMObjects):
* loader/EmptyClients.h:
(WebCore::EmptyDeviceOrientationClient::startUpdating):
(WebCore::EmptyDeviceOrientationClient::stopUpdating):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::addEventListener):
(WebCore::DOMWindow::removeEventListener):
(WebCore::DOMWindow::removeAllEventListeners):
* page/DeviceClient.h: Removed.
* page/DeviceController.cpp: Removed.
* page/DeviceController.h: Removed.

Source/WebKit/qt:

* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
(DumpRenderTreeSupportQt::setMockDeviceOrientation):

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (133027 => 133028)


--- trunk/Source/WebCore/CMakeLists.txt	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebCore/CMakeLists.txt	2012-10-31 14:59:59 UTC (rev 133028)
@@ -1710,7 +1710,6 @@
     page/ContentSecurityPolicy.cpp
     page/ContextMenuController.cpp
     page/Crypto.cpp
-    page/DeviceController.cpp
     page/DiagnosticLoggingKeys.cpp
     page/DOMSecurityPolicy.cpp
     page/DOMSelection.cpp

Modified: trunk/Source/WebCore/ChangeLog (133027 => 133028)


--- trunk/Source/WebCore/ChangeLog	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebCore/ChangeLog	2012-10-31 14:59:59 UTC (rev 133028)
@@ -1,3 +1,52 @@
+2012-10-31  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r133016.
+        http://trac.webkit.org/changeset/133016
+        https://bugs.webkit.org/show_bug.cgi?id=100856
+
+        broke compile-webkit on several bots (Requested by podivilov
+        on #webkit).
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/DeviceOrientationClient.h:
+        (DeviceOrientationClient):
+        * dom/DeviceOrientationController.cpp:
+        (WebCore::DeviceOrientationController::DeviceOrientationController):
+        (WebCore):
+        (WebCore::DeviceOrientationController::~DeviceOrientationController):
+        (WebCore::DeviceOrientationController::timerFired):
+        (WebCore::DeviceOrientationController::addListener):
+        (WebCore::DeviceOrientationController::removeListener):
+        (WebCore::DeviceOrientationController::removeAllListeners):
+        (WebCore::DeviceOrientationController::suspendEventsForAllListeners):
+        (WebCore::DeviceOrientationController::resumeEventsForAllListeners):
+        (WebCore::DeviceOrientationController::didChangeDeviceOrientation):
+        (WebCore::DeviceOrientationController::supplementName):
+        * dom/DeviceOrientationController.h:
+        (WebCore):
+        (DeviceOrientationController):
+        (WebCore::DeviceOrientationController::isActive):
+        (WebCore::DeviceOrientationController::client):
+        (WebCore::DeviceOrientationController::from):
+        * dom/Document.cpp:
+        (WebCore::Document::suspendActiveDOMObjects):
+        (WebCore::Document::resumeActiveDOMObjects):
+        * loader/EmptyClients.h:
+        (WebCore::EmptyDeviceOrientationClient::startUpdating):
+        (WebCore::EmptyDeviceOrientationClient::stopUpdating):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::addEventListener):
+        (WebCore::DOMWindow::removeEventListener):
+        (WebCore::DOMWindow::removeAllEventListeners):
+        * page/DeviceClient.h: Removed.
+        * page/DeviceController.cpp: Removed.
+        * page/DeviceController.h: Removed.
+
 2012-10-31  Antti Koivisto  <[email protected]>
 
         Remove stray calls to mutableAttributeData()

Modified: trunk/Source/WebCore/GNUmakefile.list.am (133027 => 133028)


--- trunk/Source/WebCore/GNUmakefile.list.am	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2012-10-31 14:59:59 UTC (rev 133028)
@@ -4007,9 +4007,6 @@
 	Source/WebCore/page/Coordinates.h \
 	Source/WebCore/page/Crypto.cpp \
 	Source/WebCore/page/Crypto.h \
-	Source/WebCore/page/DeviceClient.h \
-	Source/WebCore/page/DeviceController.cpp \
-	Source/WebCore/page/DeviceController.h \
 	Source/WebCore/page/DiagnosticLoggingKeys.cpp \
 	Source/WebCore/page/DiagnosticLoggingKeys.h \
 	Source/WebCore/page/DOMSecurityPolicy.cpp \

Modified: trunk/Source/WebCore/Target.pri (133027 => 133028)


--- trunk/Source/WebCore/Target.pri	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebCore/Target.pri	2012-10-31 14:59:59 UTC (rev 133028)
@@ -871,7 +871,6 @@
     page/ContentSecurityPolicy.cpp \
     page/ContextMenuController.cpp \
     page/Crypto.cpp \
-    page/DeviceController.cpp \
     page/DiagnosticLoggingKeys.cpp \
     page/DOMSelection.cpp \
     page/DOMTimer.cpp \
@@ -1998,8 +1997,6 @@
     page/ContextMenuController.h \
     page/ContextMenuProvider.h \
     page/Coordinates.h \
-    page/DeviceClient.h \
-    page/DeviceController.h \
     page/DiagnosticLoggingKeys.h \
     page/DOMSelection.h \
     page/DOMTimer.h \

Modified: trunk/Source/WebCore/WebCore.gypi (133027 => 133028)


--- trunk/Source/WebCore/WebCore.gypi	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebCore/WebCore.gypi	2012-10-31 14:59:59 UTC (rev 133028)
@@ -3113,9 +3113,6 @@
             'page/ContextMenuProvider.h',
             'page/Crypto.cpp',
             'page/Crypto.h',
-            'page/DeviceClient.h',
-            'page/DeviceController.cpp',
-            'page/DeviceController.h',
             'page/DiagnosticLoggingKeys.cpp',
             'page/DiagnosticLoggingKeys.h',
             'page/DOMSecurityPolicy.cpp',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (133027 => 133028)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-10-31 14:59:59 UTC (rev 133028)
@@ -26963,18 +26963,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\page\DeviceClient.h"
-				>
-			</File>
-			<File
-				RelativePath="..\page\DeviceController.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\page\DeviceController.h"
-				>
-			</File>
-			<File
 				RelativePath="..\page\DiagnosticLoggingKeys.cpp"
 				>
 			</File>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (133027 => 133028)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-10-31 14:59:59 UTC (rev 133028)
@@ -5891,9 +5891,6 @@
 		CAE9F90F146441F000C245B0 /* CSSAspectRatioValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CAE9F90D146441F000C245B0 /* CSSAspectRatioValue.cpp */; };
 		CAE9F910146441F000C245B0 /* CSSAspectRatioValue.h in Headers */ = {isa = PBXBuildFile; fileRef = CAE9F90E146441F000C245B0 /* CSSAspectRatioValue.h */; };
 		CAE9F910146441F000C245B1 /* CSSVariableValue.h in Headers */ = {isa = PBXBuildFile; fileRef = CAE9F90E146441F000C245B1 /* CSSVariableValue.h */; };
-		CCC2B51415F613060048CDD6 /* DeviceClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CCC2B51015F613060048CDD6 /* DeviceClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		CCC2B51515F613060048CDD6 /* DeviceController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CCC2B51115F613060048CDD6 /* DeviceController.cpp */; };
-		CCC2B51615F613060048CDD6 /* DeviceController.h in Headers */ = {isa = PBXBuildFile; fileRef = CCC2B51215F613060048CDD6 /* DeviceController.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		CD127DED14F3097D00E84779 /* WebCoreFullScreenWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD127DEB14F3097900E84779 /* WebCoreFullScreenWindow.mm */; };
 		CD127DEE14F3098400E84779 /* WebCoreFullScreenWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = CD127DEA14F3097900E84779 /* WebCoreFullScreenWindow.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		CD27F6E51457685A0078207D /* JSMediaController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD27F6E2145767580078207D /* JSMediaController.cpp */; };
@@ -13269,9 +13266,6 @@
 		CAE9F90D146441F000C245B0 /* CSSAspectRatioValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSAspectRatioValue.cpp; sourceTree = "<group>"; };
 		CAE9F90E146441F000C245B0 /* CSSAspectRatioValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSAspectRatioValue.h; sourceTree = "<group>"; };
 		CAE9F90E146441F000C245B1 /* CSSVariableValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSVariableValue.h; sourceTree = "<group>"; };
-		CCC2B51015F613060048CDD6 /* DeviceClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceClient.h; sourceTree = "<group>"; };
-		CCC2B51115F613060048CDD6 /* DeviceController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceController.cpp; sourceTree = "<group>"; };
-		CCC2B51215F613060048CDD6 /* DeviceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceController.h; sourceTree = "<group>"; };
 		CD127DEA14F3097900E84779 /* WebCoreFullScreenWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreFullScreenWindow.h; sourceTree = "<group>"; };
 		CD127DEB14F3097900E84779 /* WebCoreFullScreenWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreFullScreenWindow.mm; sourceTree = "<group>"; };
 		CD27F6E014575C1B0078207D /* MediaController.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MediaController.idl; sourceTree = "<group>"; };
@@ -15860,9 +15854,6 @@
 				975CA287130365F800E99AD9 /* Crypto.cpp */,
 				975CA288130365F800E99AD9 /* Crypto.h */,
 				975CA289130365F800E99AD9 /* Crypto.idl */,
-				CCC2B51015F613060048CDD6 /* DeviceClient.h */,
-				CCC2B51115F613060048CDD6 /* DeviceController.cpp */,
-				CCC2B51215F613060048CDD6 /* DeviceController.h */,
 				CD37B37415C1A7E1006DC898 /* DiagnosticLoggingKeys.cpp */,
 				CD37B37515C1A7E1006DC898 /* DiagnosticLoggingKeys.h */,
 				2D9A246A15B9BBDD00D34527 /* DOMSecurityPolicy.cpp */,
@@ -22786,8 +22777,6 @@
 				93309DE1099E64920056E581 /* DeleteSelectionCommand.h in Headers */,
 				FD1660A513787C6D001FFA7B /* DenormalDisabler.h in Headers */,
 				A7C9ABF91357A3BF00F5503F /* DetailsMarkerControl.h in Headers */,
-				CCC2B51415F613060048CDD6 /* DeviceClient.h in Headers */,
-				CCC2B51615F613060048CDD6 /* DeviceController.h in Headers */,
 				31FB1A57120A5D0600DC02A0 /* DeviceMotionClient.h in Headers */,
 				31FB1A59120A5D0600DC02A0 /* DeviceMotionController.h in Headers */,
 				31FB1A5B120A5D0600DC02A0 /* DeviceMotionData.h in Headers */,
@@ -26346,7 +26335,6 @@
 				93309DDE099E64920056E581 /* DeleteFromTextNodeCommand.cpp in Sources */,
 				93309DE0099E64920056E581 /* DeleteSelectionCommand.cpp in Sources */,
 				A7C9ABF81357A3BF00F5503F /* DetailsMarkerControl.cpp in Sources */,
-				CCC2B51515F613060048CDD6 /* DeviceController.cpp in Sources */,
 				31FB1A58120A5D0600DC02A0 /* DeviceMotionController.cpp in Sources */,
 				31FB1A5A120A5D0600DC02A0 /* DeviceMotionData.cpp in Sources */,
 				31FB1A5C120A5D0600DC02A0 /* DeviceMotionEvent.cpp in Sources */,

Modified: trunk/Source/WebCore/dom/DeviceOrientationClient.h (133027 => 133028)


--- trunk/Source/WebCore/dom/DeviceOrientationClient.h	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebCore/dom/DeviceOrientationClient.h	2012-10-31 14:59:59 UTC (rev 133028)
@@ -1,6 +1,5 @@
 /*
  * Copyright 2010, The Android Open Source Project
- * Copyright (C) 2012 Samsung Electronics. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,18 +26,18 @@
 #ifndef DeviceOrientationClient_h
 #define DeviceOrientationClient_h
 
-#include "DeviceClient.h"
-
 namespace WebCore {
 
 class DeviceOrientationController;
 class DeviceOrientationData;
 class Page;
 
-class DeviceOrientationClient : public DeviceClient {
+class DeviceOrientationClient {
 public:
     virtual ~DeviceOrientationClient() {}
     virtual void setController(DeviceOrientationController*) = 0;
+    virtual void startUpdating() = 0;
+    virtual void stopUpdating() = 0;
     virtual DeviceOrientationData* lastOrientation() const = 0;
     virtual void deviceOrientationControllerDestroyed() = 0;
 };

Modified: trunk/Source/WebCore/dom/DeviceOrientationController.cpp (133027 => 133028)


--- trunk/Source/WebCore/dom/DeviceOrientationController.cpp	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebCore/dom/DeviceOrientationController.cpp	2012-10-31 14:59:59 UTC (rev 133028)
@@ -1,6 +1,5 @@
 /*
  * Copyright 2010, The Android Open Source Project
- * Copyright (C) 2012 Samsung Electronics. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -35,49 +34,117 @@
 namespace WebCore {
 
 DeviceOrientationController::DeviceOrientationController(Page* page, DeviceOrientationClient* client)
-    : DeviceController(client)
+    : m_client(client)
     , m_page(page)
+    , m_timer(this, &DeviceOrientationController::timerFired)
 {
     ASSERT(m_client);
-    deviceOrientationClient()->setController(this);
+    m_client->setController(this);
 }
 
+DeviceOrientationController::~DeviceOrientationController()
+{
+    m_client->deviceOrientationControllerDestroyed();
+}
+
 PassOwnPtr<DeviceOrientationController> DeviceOrientationController::create(Page* page, DeviceOrientationClient* client)
 {
     return adoptPtr(new DeviceOrientationController(page, client));
 }
 
-void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientationData* orientation)
+void DeviceOrientationController::timerFired(Timer<DeviceOrientationController>* timer)
 {
-    dispatchDeviceEvent(DeviceOrientationEvent::create(eventNames().deviceorientationEvent, orientation));
+    ASSERT_UNUSED(timer, timer == &m_timer);
+    ASSERT(m_client->lastOrientation());
+
+    RefPtr<DeviceOrientationData> orientation = m_client->lastOrientation();
+    RefPtr<DeviceOrientationEvent> event = DeviceOrientationEvent::create(eventNames().deviceorientationEvent, orientation.get());
+
+    Vector<RefPtr<DOMWindow> > listenersVector;
+    copyToVector(m_newListeners, listenersVector);
+    m_newListeners.clear();
+    for (size_t i = 0; i < listenersVector.size(); ++i)
+        listenersVector[i]->dispatchEvent(event);
 }
 
-DeviceOrientationClient* DeviceOrientationController::deviceOrientationClient()
+void DeviceOrientationController::addListener(DOMWindow* window)
 {
-    return static_cast<DeviceOrientationClient*>(m_client);
+    // If the client already has an orientation, we should fire an event with that
+    // orientation. The event is fired asynchronously, but without
+    // waiting for the client to get a new orientation.
+    if (m_client->lastOrientation()) {
+        m_newListeners.add(window);
+        if (!m_timer.isActive())
+            m_timer.startOneShot(0);
+    }
+
+    // The client must not call back synchronously.
+    bool wasEmpty = m_listeners.isEmpty();
+    m_listeners.add(window);
+    if (wasEmpty)
+        m_client->startUpdating();
 }
 
-bool DeviceOrientationController::hasLastData()
+void DeviceOrientationController::removeListener(DOMWindow* window)
 {
-    return deviceOrientationClient()->lastOrientation();
+    m_listeners.remove(window);
+    m_suspendedListeners.remove(window);
+    m_newListeners.remove(window);
+    if (m_listeners.isEmpty())
+        m_client->stopUpdating();
 }
 
-PassRefPtr<Event> DeviceOrientationController::getLastEvent()
+void DeviceOrientationController::removeAllListeners(DOMWindow* window)
 {
-    return DeviceOrientationEvent::create(eventNames().deviceorientationEvent, deviceOrientationClient()->lastOrientation());
+    // May be called with a DOMWindow that's not a listener.
+    if (!m_listeners.contains(window))
+        return;
+
+    m_listeners.removeAll(window);
+    m_suspendedListeners.removeAll(window);
+    m_newListeners.remove(window);
+    if (m_listeners.isEmpty())
+        m_client->stopUpdating();
 }
 
+void DeviceOrientationController::suspendEventsForAllListeners(DOMWindow* window)
+{
+    if (!m_listeners.contains(window))
+        return;
+
+    int count = m_listeners.count(window);
+    removeAllListeners(window);
+    while (count--)
+        m_suspendedListeners.add(window);
+}
+
+void DeviceOrientationController::resumeEventsForAllListeners(DOMWindow* window)
+{
+    if (!m_suspendedListeners.contains(window))
+        return;
+
+    int count = m_suspendedListeners.count(window);
+    m_suspendedListeners.removeAll(window);
+    while (count--)
+        addListener(window);
+}
+
+void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientationData* orientation)
+{
+    orientation = InspectorInstrumentation::overrideDeviceOrientation(m_page, orientation);
+    RefPtr<DeviceOrientationEvent> event = DeviceOrientationEvent::create(eventNames().deviceorientationEvent, orientation);
+    Vector<RefPtr<DOMWindow> > listenersVector;
+    copyToVector(m_listeners, listenersVector);
+    for (size_t i = 0; i < listenersVector.size(); ++i)
+        listenersVector[i]->dispatchEvent(event);
+}
+
 const AtomicString& DeviceOrientationController::supplementName()
 {
     DEFINE_STATIC_LOCAL(AtomicString, name, ("DeviceOrientationController"));
     return name;
 }
 
-DeviceOrientationController* DeviceOrientationController::from(Page* page)
-{
-    return static_cast<DeviceOrientationController*>(Supplement<Page>::from(page, supplementName()));
-}
-
 bool DeviceOrientationController::isActiveAt(Page* page)
 {
     if (DeviceOrientationController* self = DeviceOrientationController::from(page))

Modified: trunk/Source/WebCore/dom/DeviceOrientationController.h (133027 => 133028)


--- trunk/Source/WebCore/dom/DeviceOrientationController.h	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebCore/dom/DeviceOrientationController.h	2012-10-31 14:59:59 UTC (rev 133028)
@@ -1,6 +1,5 @@
 /*
  * Copyright 2010, The Android Open Source Project
- * Copyright (C) 2012 Samsung Electronics. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,34 +26,53 @@
 #ifndef DeviceOrientationController_h
 #define DeviceOrientationController_h
 
-#include "DeviceController.h"
+#include "DOMWindow.h"
+#include "Page.h"
+#include "Timer.h"
+
 #include <wtf/HashCountedSet.h>
 
 namespace WebCore {
 
+class DeviceOrientationData;
 class DeviceOrientationClient;
-class DeviceOrientationData;
 
-class DeviceOrientationController : public DeviceController {
+class DeviceOrientationController : public Supplement<Page> {
 public:
-    ~DeviceOrientationController() { };
+    ~DeviceOrientationController();
 
     static PassOwnPtr<DeviceOrientationController> create(Page*, DeviceOrientationClient*);
 
+    void addListener(DOMWindow*);
+    void removeListener(DOMWindow*);
+    void removeAllListeners(DOMWindow*);
+
+    void suspendEventsForAllListeners(DOMWindow*);
+    void resumeEventsForAllListeners(DOMWindow*);
+
     void didChangeDeviceOrientation(DeviceOrientationData*);
-    DeviceOrientationClient* deviceOrientationClient();
 
-    virtual bool hasLastData() OVERRIDE;
-    virtual PassRefPtr<Event> getLastEvent() OVERRIDE;
+    bool isActive() { return !m_listeners.isEmpty(); }
 
+    DeviceOrientationClient* client() const { return m_client; }
+
     static const AtomicString& supplementName();
-    static DeviceOrientationController* from(Page*);
+    static DeviceOrientationController* from(Page* page) { return static_cast<DeviceOrientationController*>(Supplement<Page>::from(page, supplementName())); }
     static bool isActiveAt(Page*);
 
 private:
-    DeviceOrientationController(Page*, DeviceOrientationClient*);
+    explicit DeviceOrientationController(Page*, DeviceOrientationClient*);
 
+    void timerFired(Timer<DeviceOrientationController>*);
+
+    DeviceOrientationClient* m_client;
     Page* m_page;
+    typedef HashCountedSet<RefPtr<DOMWindow> > ListenersCountedSet;
+    ListenersCountedSet m_listeners;
+    ListenersCountedSet m_suspendedListeners;
+    typedef HashSet<RefPtr<DOMWindow> > ListenersSet;
+    ListenersSet m_newListeners;
+    Timer<DeviceOrientationController> m_timer;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/Document.cpp (133027 => 133028)


--- trunk/Source/WebCore/dom/Document.cpp	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebCore/dom/Document.cpp	2012-10-31 14:59:59 UTC (rev 133028)
@@ -2182,6 +2182,9 @@
 
     if (DeviceMotionController* controller = DeviceMotionController::from(page()))
         controller->suspendEventsForAllListeners(domWindow());
+    if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
+        controller->suspendEventsForAllListeners(domWindow());
+
 #endif
 }
 
@@ -2195,6 +2198,8 @@
 
     if (DeviceMotionController* controller = DeviceMotionController::from(page()))
         controller->resumeEventsForAllListeners(domWindow());
+    if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
+        controller->resumeEventsForAllListeners(domWindow());
 #endif
 }
 

Modified: trunk/Source/WebCore/loader/EmptyClients.h (133027 => 133028)


--- trunk/Source/WebCore/loader/EmptyClients.h	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2012-10-31 14:59:59 UTC (rev 133028)
@@ -573,12 +573,6 @@
     virtual void hideHighlight() { }
 };
 
-class EmptyDeviceClient : public DeviceClient {
-public:
-    virtual void startUpdating() OVERRIDE { }
-    virtual void stopUpdating() OVERRIDE { }
-};
-
 class EmptyDeviceMotionClient : public DeviceMotionClient {
 public:
     virtual void setController(DeviceMotionController*) { }
@@ -591,6 +585,8 @@
 class EmptyDeviceOrientationClient : public DeviceOrientationClient {
 public:
     virtual void setController(DeviceOrientationController*) { }
+    virtual void startUpdating() { }
+    virtual void stopUpdating() { }
     virtual DeviceOrientationData* lastOrientation() const { return 0; }
     virtual void deviceOrientationControllerDestroyed() { }
 };

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (133027 => 133028)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2012-10-31 14:59:59 UTC (rev 133028)
@@ -1601,7 +1601,7 @@
             controller->addListener(this);
     } else if (eventType == eventNames().deviceorientationEvent && RuntimeEnabledFeatures::deviceOrientationEnabled()) {
         if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
-            controller->addDeviceEventListener(this);
+            controller->addListener(this);
     }
 #endif
 
@@ -1630,7 +1630,7 @@
             controller->removeListener(this);
     } else if (eventType == eventNames().deviceorientationEvent) {
         if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
-            controller->removeDeviceEventListener(this);
+            controller->removeListener(this);
     }
 #endif
 
@@ -1687,7 +1687,7 @@
     if (DeviceMotionController* controller = DeviceMotionController::from(page()))
         controller->removeAllListeners(this);
     if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
-        controller->removeAllDeviceEventListeners(this);
+        controller->removeAllListeners(this);
 #endif
 
     removeAllUnloadEventListeners(this);

Deleted: trunk/Source/WebCore/page/DeviceClient.h (133027 => 133028)


--- trunk/Source/WebCore/page/DeviceClient.h	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebCore/page/DeviceClient.h	2012-10-31 14:59:59 UTC (rev 133028)
@@ -1,42 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- * Copyright (C) 2012 Samsung Electronics. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DeviceClient_h
-#define DeviceClient_h
-
-namespace WebCore {
-
-class DeviceClient {
-public:
-    virtual ~DeviceClient() { }
-
-    virtual void startUpdating() = 0;
-    virtual void stopUpdating() = 0;
-};
-
-} // namespace WebCore
-
-#endif // DeviceClient_h

Deleted: trunk/Source/WebCore/page/DeviceController.cpp (133027 => 133028)


--- trunk/Source/WebCore/page/DeviceController.cpp	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebCore/page/DeviceController.cpp	2012-10-31 14:59:59 UTC (rev 133028)
@@ -1,102 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- * Copyright (C) 2012 Samsung Electronics. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "DeviceController.h"
-
-#include "DOMWindow.h"
-#include "DeviceClient.h"
-#include "Document.h"
-#include "Page.h"
-
-namespace WebCore {
-
-DeviceController::DeviceController(DeviceClient* client)
-    : m_client(client)
-    , m_timer(this, &DeviceController::fireDeviceEvent)
-{
-    ASSERT(m_client);
-}
-
-void DeviceController::addDeviceEventListener(DOMWindow* window)
-{
-    bool wasEmpty = m_listeners.isEmpty();
-    m_listeners.add(window);
-
-    if (hasLastData()) {
-        m_lastEventListeners.add(window);
-        if (!m_timer.isActive())
-            m_timer.startOneShot(0);
-    }
-
-    if (!wasEmpty)
-        m_client->startUpdating();
-}
-
-void DeviceController::removeDeviceEventListener(DOMWindow* window)
-{
-    m_listeners.remove(window);
-    m_lastEventListeners.remove(window);
-    if (m_listeners.isEmpty())
-        m_client->stopUpdating();
-}
-
-void DeviceController::removeAllDeviceEventListeners(DOMWindow* window)
-{
-    m_listeners.removeAll(window);
-    m_lastEventListeners.removeAll(window);
-    if (m_listeners.isEmpty())
-        m_client->stopUpdating();
-}
-
-void DeviceController::dispatchDeviceEvent(PassRefPtr<Event> event)
-{
-    Vector<DOMWindow*> listenerVector;
-    copyToVector(m_listeners, listenerVector);
-    for (size_t i = 0; i < listenerVector.size(); ++i) {
-        if (!listenerVector[i]->document()->activeDOMObjectsAreSuspended()
-            && !listenerVector[i]->document()->activeDOMObjectsAreStopped())
-        listenerVector[i]->dispatchEvent(event);
-    }
-}
-
-void DeviceController::fireDeviceEvent(Timer<DeviceController>* timer)
-{
-    ASSERT_UNUSED(timer, timer == &m_timer);
-    ASSERT(hasLastData());
-
-    m_timer.stop();
-    Vector<DOMWindow*> listenerVector;
-    copyToVector(m_lastEventListeners, listenerVector);
-    m_lastEventListeners.clear();
-    for (size_t i = 0; i < listenerVector.size(); ++i) {
-        if (!listenerVector[i]->document()->activeDOMObjectsAreSuspended()
-            && !listenerVector[i]->document()->activeDOMObjectsAreStopped())
-        listenerVector[i]->dispatchEvent(getLastEvent());
-    }
-}
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/page/DeviceController.h (133027 => 133028)


--- trunk/Source/WebCore/page/DeviceController.h	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebCore/page/DeviceController.h	2012-10-31 14:59:59 UTC (rev 133028)
@@ -1,68 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- * Copyright (C) 2012 Samsung Electronics. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DeviceController_h
-#define DeviceController_h
-
-#include "Event.h"
-#include "Supplementable.h"
-#include "Timer.h"
-#include <wtf/HashCountedSet.h>
-
-namespace WebCore {
-
-class DOMWindow;
-class DeviceClient;
-class Page;
-
-class DeviceController : public Supplement<Page> {
-public:
-    explicit DeviceController(DeviceClient*);
-    ~DeviceController() { }
-
-    void addDeviceEventListener(DOMWindow*);
-    void removeDeviceEventListener(DOMWindow*);
-    void removeAllDeviceEventListeners(DOMWindow*);
-
-    void dispatchDeviceEvent(PassRefPtr<Event>);
-    bool isActive() { return !m_listeners.isEmpty(); }
-    DeviceClient* client() { return m_client; }
-
-    virtual bool hasLastData() { return false; }
-    virtual PassRefPtr<Event> getLastEvent() { return 0; }
-
-protected:
-    void fireDeviceEvent(Timer<DeviceController>*);
-
-    HashCountedSet<DOMWindow*> m_listeners;
-    HashCountedSet<DOMWindow*> m_lastEventListeners;
-    DeviceClient* m_client;
-    Timer<DeviceController> m_timer;
-};
-
-} // namespace WebCore
-
-#endif // DeviceController_h

Modified: trunk/Source/WebKit/qt/ChangeLog (133027 => 133028)


--- trunk/Source/WebKit/qt/ChangeLog	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebKit/qt/ChangeLog	2012-10-31 14:59:59 UTC (rev 133028)
@@ -1,3 +1,15 @@
+2012-10-31  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r133016.
+        http://trac.webkit.org/changeset/133016
+        https://bugs.webkit.org/show_bug.cgi?id=100856
+
+        broke compile-webkit on several bots (Requested by podivilov
+        on #webkit).
+
+        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+        (DumpRenderTreeSupportQt::setMockDeviceOrientation):
+
 2012-10-31  Kihong Kwon  <[email protected]>
 
         Add DeviceController base-class to remove duplication of DeviceXXXControler

Modified: trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp (133027 => 133028)


--- trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp	2012-10-31 14:22:49 UTC (rev 133027)
+++ trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp	2012-10-31 14:59:59 UTC (rev 133028)
@@ -713,7 +713,7 @@
 {
 #if ENABLE(DEVICE_ORIENTATION)
     Page* corePage = QWebPagePrivate::core(page);
-    DeviceOrientationClientMock* mockClient = toDeviceOrientationClientMock(DeviceOrientationController::from(corePage)->deviceOrientationClient());
+    DeviceOrientationClientMock* mockClient = toDeviceOrientationClientMock(DeviceOrientationController::from(corePage)->client());
     mockClient->setOrientation(DeviceOrientationData::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma));
 #endif
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to