Changeset 206410 in webkit


Ignore:
Timestamp:
Sep 26, 2016 8:35:01 PM (8 years ago)
Author:
mitz@apple.com
Message:

-_webViewWebProcessDidBecomeUnresponsive: gets called when the Web process is stopped in the debugger
https://bugs.webkit.org/show_bug.cgi?id=162234

Reviewed by Sam Weinig.

  • UIProcess/Cocoa/WebProcessProxyCocoa.mm:

(WebKit::WebProcessProxy::platformIsBeingDebugged): Use the KERN_PROC sysctl to get the

process flags and check for P_TRACED.

  • UIProcess/ResponsivenessTimer.cpp:

(WebKit::ResponsivenessTimer::timerFired): Call the new client function

mayBecomeUnresponsive. If it returns false, restart the timer and bail out without
changing the responsiveness state.

  • UIProcess/ResponsivenessTimer.h: Declared new client function mayBecomeUnresponsive.
  • UIProcess/WebProcessProxy.cpp:

(WebKit::WebProcessProxy::platformIsBeingDebugged): A generic implementation that always

returns false.

(WebKit::WebProcessProxy::mayBecomeUnresponsive): Implement this new

ResponsivenessTimer::Client function to return true unless the process is being debugged.

  • UIProcess/WebProcessProxy.h:
Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r206397 r206410  
     12016-09-26  Dan Bernstein  <mitz@apple.com>
     2
     3        -_webViewWebProcessDidBecomeUnresponsive: gets called when the Web process is stopped in the debugger
     4        https://bugs.webkit.org/show_bug.cgi?id=162234
     5
     6        Reviewed by Sam Weinig.
     7
     8        * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
     9        (WebKit::WebProcessProxy::platformIsBeingDebugged): Use the KERN_PROC sysctl to get the
     10          process flags and check for P_TRACED.
     11
     12        * UIProcess/ResponsivenessTimer.cpp:
     13        (WebKit::ResponsivenessTimer::timerFired): Call the new client function
     14          mayBecomeUnresponsive. If it returns false, restart the timer and bail out without
     15          changing the responsiveness state.
     16
     17        * UIProcess/ResponsivenessTimer.h: Declared new client function mayBecomeUnresponsive.
     18
     19        * UIProcess/WebProcessProxy.cpp:
     20        (WebKit::WebProcessProxy::platformIsBeingDebugged): A generic implementation that always
     21          returns false.
     22        (WebKit::WebProcessProxy::mayBecomeUnresponsive): Implement this new
     23          ResponsivenessTimer::Client function to return true unless the process is being debugged.
     24        * UIProcess/WebProcessProxy.h:
     25
    1262016-09-26  Chris Dumez  <cdumez@apple.com>
    227
  • trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessProxyCocoa.mm

    r203003 r206410  
    3131#import "WKBrowsingContextHandleInternal.h"
    3232#import "WKTypeRefWrapper.h"
     33#import <sys/sysctl.h>
    3334#import <wtf/NeverDestroyed.h>
    3435
     
    121122}
    122123
     124bool WebProcessProxy::platformIsBeingDebugged() const
     125{
     126    struct kinfo_proc info;
     127    int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, processIdentifier() };
     128    size_t size = sizeof(info);
     129    if (sysctl(mib, WTF_ARRAY_LENGTH(mib), &info, &size, nullptr, 0) == -1)
     130        return false;
     131
     132    return info.kp_proc.p_flag & P_TRACED;
    123133}
     134
     135}
  • trunk/Source/WebKit2/UIProcess/ResponsivenessTimer.cpp

    r202611 r206410  
    5353        return;
    5454
     55    if (!m_client.mayBecomeUnresponsive()) {
     56        m_timer.startOneShot(responsivenessTimeout);
     57        return;
     58    }
     59
    5560    m_client.willChangeIsResponsive();
    5661    m_isResponsive = false;
  • trunk/Source/WebKit2/UIProcess/ResponsivenessTimer.h

    r202611 r206410  
    4141        virtual void willChangeIsResponsive() = 0;
    4242        virtual void didChangeIsResponsive() = 0;
     43
     44        virtual bool mayBecomeUnresponsive() = 0;
    4345    };
    4446
  • trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp

    r205462 r206410  
    473473}
    474474
     475#if !PLATFORM(COCOA)
     476bool WebProcessProxy::platformIsBeingDebugged() const
     477{
     478    return false;
     479}
     480#endif
     481
    475482void WebProcessProxy::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder)
    476483{
     
    578585    for (auto& page : pages)
    579586        page->didChangeProcessIsResponsive();
     587}
     588
     589bool WebProcessProxy::mayBecomeUnresponsive()
     590{
     591    return !platformIsBeingDebugged();
    580592}
    581593
  • trunk/Source/WebKit2/UIProcess/WebProcessProxy.h

    r205213 r206410  
    187187    void releaseRemainingIconsForPageURLs();
    188188
     189    bool platformIsBeingDebugged() const;
     190
    189191    static const HashSet<String>& platformPathsWithAssumedReadAccess();
    190192
     
    201203    void willChangeIsResponsive() override;
    202204    void didChangeIsResponsive() override;
     205    bool mayBecomeUnresponsive() override;
    203206
    204207    // ProcessThrottlerClient
Note: See TracChangeset for help on using the changeset viewer.