Changeset 176133 in webkit


Ignore:
Timestamp:
Nov 14, 2014 12:05:26 PM (9 years ago)
Author:
mitz@apple.com
Message:

Add some tracing to help investigating <rdar://problem/18905383> [iOS] Crash due to null m_webPageProxyForBackForwardListForCurrentSwipe in ViewGestureController::endSwipeGesture
https://bugs.webkit.org/show_bug.cgi?id=138750

Reviewed by Tim Horton.

Emit trace messages at various points, and log them prior to crashing if the error condition
occurs. Otherwise, clear the trace messages.

  • UIProcess/ios/ViewGestureControllerIOS.mm:

(WebKit::addLogEntry): Helper function that adds a message, including a time stamp and a
backtrace, to m_logEntries.
(WebKit::dumpLogEntries): Helper function that logs everything in m_logEntries.
(WebKit::ViewGestureController::beginSwipeGesture): Add a log entry.
(WebKit::ViewGestureController::endSwipeGesture): If
m_webPageProxyForBackForwardListForCurrentSwipe is null, dump the log entries just before
crashing. Otherwise, clear m_logEntries.
(WebKit::ViewGestureController::willCommitPostSwipeTransitionLayerTree): Add a log entry.
(WebKit::ViewGestureController::removeSwipeSnapshot): Add a log entry.

  • UIProcess/mac/ViewGestureController.h: Defined ENABLE_VIEW_GESTURE_CONTROLLER_TRACING,

and added m_logEntries member variable.

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r176131 r176133  
     12014-11-14  Dan Bernstein  <mitz@apple.com>
     2
     3        Add some tracing to help investigating <rdar://problem/18905383> [iOS] Crash due to null m_webPageProxyForBackForwardListForCurrentSwipe in ViewGestureController::endSwipeGesture
     4        https://bugs.webkit.org/show_bug.cgi?id=138750
     5
     6        Reviewed by Tim Horton.
     7
     8        Emit trace messages at various points, and log them prior to crashing if the error condition
     9        occurs. Otherwise, clear the trace messages.
     10
     11        * UIProcess/ios/ViewGestureControllerIOS.mm:
     12        (WebKit::addLogEntry): Helper function that adds a message, including a time stamp and a
     13        backtrace, to m_logEntries.
     14        (WebKit::dumpLogEntries): Helper function that logs everything in m_logEntries.
     15        (WebKit::ViewGestureController::beginSwipeGesture): Add a log entry.
     16        (WebKit::ViewGestureController::endSwipeGesture): If
     17        m_webPageProxyForBackForwardListForCurrentSwipe is null, dump the log entries just before
     18        crashing. Otherwise, clear m_logEntries.
     19        (WebKit::ViewGestureController::willCommitPostSwipeTransitionLayerTree): Add a log entry.
     20        (WebKit::ViewGestureController::removeSwipeSnapshot): Add a log entry.
     21        * UIProcess/mac/ViewGestureController.h: Defined ENABLE_VIEW_GESTURE_CONTROLLER_TRACING,
     22        and added m_logEntries member variable.
     23
    1242014-11-14  Beth Dakin  <bdakin@apple.com>
    225
  • trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm

    r174788 r176133  
    4747#import <WebCore/IOSurface.h>
    4848#import <wtf/NeverDestroyed.h>
     49#import <wtf/text/StringBuilder.h>
    4950
    5051using namespace WebCore;
     
    171172}
    172173
     174#if ENABLE(VIEW_GESTURE_CONTROLLER_TRACING)
     175static void addLogEntry(Vector<String>& entries, const String& message)
     176{
     177    void* stack[32];
     178    int size = WTF_ARRAY_LENGTH(stack);
     179    WTFGetBacktrace(stack, &size);
     180    StringBuilder stringBuilder;
     181    stringBuilder.append(String::format("%f [ ]", CFAbsoluteTimeGetCurrent()));
     182    for (int i = 2; i < size; ++i) {
     183        if (i > 2)
     184            stringBuilder.appendLiteral(", ");
     185        stringBuilder.append(String::format("%p", stack[i]));
     186    }
     187    stringBuilder.appendLiteral(" ] ");
     188    stringBuilder.append(message);
     189    entries.append(stringBuilder.toString());
     190}
     191
     192static void dumpLogEntries(const Vector<String>& entries, WebPageProxy* webPageProxy)
     193{
     194    for (const auto& entry: entries)
     195        WTFLogAlways(entry.utf8().data());
     196    WTFLogAlways("m_webPageProxy: %p", webPageProxy);
     197}
     198#endif
     199
    173200void ViewGestureController::beginSwipeGesture(_UINavigationInteractiveTransitionBase *transition, SwipeDirection direction)
    174201{
     
    179206
    180207    m_webPageProxyForBackForwardListForCurrentSwipe = m_alternateBackForwardListSourceView.get() ? m_alternateBackForwardListSourceView.get()->_page : &m_webPageProxy;
     208#if ENABLE(VIEW_GESTURE_CONTROLLER_TRACING)
     209    addLogEntry(m_logEntries, String::format("m_webPageProxyForBackForwardListForCurrentSwipe: %p", m_webPageProxyForBackForwardListForCurrentSwipe.get()));
     210#endif
    181211    m_webPageProxyForBackForwardListForCurrentSwipe->navigationGestureDidBegin();
    182212
     
    280310        RefPtr<WebPageProxy> webPageProxyForBackForwardListForCurrentSwipe = m_webPageProxyForBackForwardListForCurrentSwipe;
    281311        removeSwipeSnapshot();
     312#if ENABLE(VIEW_GESTURE_CONTROLLER_TRACING)
     313        if (!webPageProxyForBackForwardListForCurrentSwipe)
     314            dumpLogEntries(m_logEntries, &m_webPageProxy);
     315        m_logEntries.clear();
     316#endif
     317
    282318        webPageProxyForBackForwardListForCurrentSwipe->navigationGestureDidEnd(false, *targetItem);
     319
    283320        return;
    284321    }
     
    287324    if (ViewSnapshot* snapshot = targetItem->snapshot())
    288325        m_snapshotRemovalTargetRenderTreeSize = snapshot->renderTreeSize() * swipeSnapshotRemovalRenderTreeSizeTargetFraction;
     326
     327#if ENABLE(VIEW_GESTURE_CONTROLLER_TRACING)
     328    if (!m_webPageProxyForBackForwardListForCurrentSwipe)
     329        dumpLogEntries(m_logEntries, &m_webPageProxy);
     330    m_logEntries.clear();
     331#endif
    289332
    290333    m_webPageProxyForBackForwardListForCurrentSwipe->navigationGestureDidEnd(true, *targetItem);
     
    308351void ViewGestureController::willCommitPostSwipeTransitionLayerTree(bool successful)
    309352{
     353#if ENABLE(VIEW_GESTURE_CONTROLLER_TRACING)
     354    addLogEntry(m_logEntries, String::format("successful: %d; m_activeGestureType: %d; m_webPageProxyForBackForwardListForCurrentSwipe: %p", successful, m_activeGestureType, m_webPageProxyForBackForwardListForCurrentSwipe.get()));
     355#endif
    310356    if (m_activeGestureType != ViewGestureType::Swipe)
    311357        return;
     
    342388    m_swipeWatchdogTimer.stop();
    343389
     390#if ENABLE(VIEW_GESTURE_CONTROLLER_TRACING)
     391    addLogEntry(m_logEntries, String::format("m_activeGestureType: %d; m_webPageProxyForBackForwardListForCurrentSwipe: %p", m_activeGestureType, m_webPageProxyForBackForwardListForCurrentSwipe.get()));
     392#endif
    344393    if (m_activeGestureType != ViewGestureType::Swipe)
    345394        return;
  • trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h

    r174788 r176133  
    3434#include <wtf/RunLoop.h>
    3535
     36#define ENABLE_VIEW_GESTURE_CONTROLLER_TRACING 1
     37
    3638OBJC_CLASS CALayer;
    3739
     
    214216    WeakObjCPtr<WKWebView> m_alternateBackForwardListSourceView;
    215217    RefPtr<WebPageProxy> m_webPageProxyForBackForwardListForCurrentSwipe;
     218#if ENABLE(VIEW_GESTURE_CONTROLLER_TRACING)
     219    Vector<String> m_logEntries;
     220#endif
    216221#endif
    217222};
Note: See TracChangeset for help on using the changeset viewer.