Changeset 65924 in webkit


Ignore:
Timestamp:
Aug 24, 2010 12:52:25 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-08-24 Hans Wennborg <hans@chromium.org>

Reviewed by Steve Block.

Remove null-checks from DeviceOrientationController
https://bugs.webkit.org/show_bug.cgi?id=44504

Remove checks for m_client being NULL from DeviceOrientationController.
It will never be NULL, and this is checked by an ASSERT on construction.

Will be covered by layout tests for device orientation.

  • dom/DeviceOrientationController.cpp: (WebCore::DeviceOrientationController::timerFired): (WebCore::DeviceOrientationController::addListener): (WebCore::DeviceOrientationController::removeListener): (WebCore::DeviceOrientationController::removeAllListeners):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r65921 r65924  
     12010-08-24  Hans Wennborg  <hans@chromium.org>
     2
     3        Reviewed by Steve Block.
     4
     5        Remove null-checks from DeviceOrientationController
     6        https://bugs.webkit.org/show_bug.cgi?id=44504
     7
     8        Remove checks for m_client being NULL from DeviceOrientationController.
     9        It will never be NULL, and this is checked by an ASSERT on construction.
     10
     11        Will be covered by layout tests for device orientation.
     12
     13        * dom/DeviceOrientationController.cpp:
     14        (WebCore::DeviceOrientationController::timerFired):
     15        (WebCore::DeviceOrientationController::addListener):
     16        (WebCore::DeviceOrientationController::removeListener):
     17        (WebCore::DeviceOrientationController::removeAllListeners):
     18
    1192010-08-24  Stephen White  <senorblanco@chromium.org>
    220
  • trunk/WebCore/dom/DeviceOrientationController.cpp

    r64356 r65924  
    4545{
    4646    ASSERT_UNUSED(timer, timer == &m_timer);
    47     ASSERT(!m_client || m_client->lastOrientation());
     47    ASSERT(m_client->lastOrientation());
    4848
    49     RefPtr<DeviceOrientation> orientation = m_client ?  m_client->lastOrientation() : DeviceOrientation::create();
     49    RefPtr<DeviceOrientation> orientation = m_client->lastOrientation();
    5050    RefPtr<DeviceOrientationEvent> event = DeviceOrientationEvent::create(eventNames().deviceorientationEvent, orientation.get());
    5151
     
    5959void DeviceOrientationController::addListener(DOMWindow* window)
    6060{
    61     // If no client is present, we should fire an event with all parameters null. If
    62     // the client already has an orientation, we should fire an event with that
    63     // orientation. In both cases, the event is fired asynchronously, but without
     61    // If the client already has an orientation, we should fire an event with that
     62    // orientation. The event is fired asynchronously, but without
    6463    // waiting for the client to get a new orientation.
    65     if (!m_client || m_client->lastOrientation()) {
     64    if (m_client->lastOrientation()) {
    6665        m_newListeners.add(window);
    6766        if (!m_timer.isActive())
     
    7271    bool wasEmpty = m_listeners.isEmpty();
    7372    m_listeners.add(window);
    74     if (wasEmpty && m_client)
     73    if (wasEmpty)
    7574        m_client->startUpdating();
    7675}
     
    8079    m_listeners.remove(window);
    8180    m_newListeners.remove(window);
    82     if (m_listeners.isEmpty() && m_client)
     81    if (m_listeners.isEmpty())
    8382        m_client->stopUpdating();
    8483}
     
    9291    m_listeners.removeAll(window);
    9392    m_newListeners.remove(window);
    94     if (m_listeners.isEmpty() && m_client)
     93    if (m_listeners.isEmpty())
    9594        m_client->stopUpdating();
    9695}
Note: See TracChangeset for help on using the changeset viewer.