Commit 6d741a97 authored by andersca@apple.com's avatar andersca@apple.com
Browse files

Source/WebKit2: Need a client callback for when the user tires to interact...

Source/WebKit2: Need a client callback for when the user tires to interact with an already unresponsive page
https://bugs.webkit.org/show_bug.cgi?id=84201
<rdar://problem/11140862>

Reviewed by Andreas Kling.

Add a interactionOccurredWhileProcessUnresponsive callback that's called when the unresponsiveness timer
fires while it's already unresponsive.

* UIProcess/API/C/WKPage.h:
* UIProcess/ResponsivenessTimer.cpp:
(WebKit):
(WebKit::ResponsivenessTimer::timerFired):
(WebKit::ResponsivenessTimer::start):
* UIProcess/ResponsivenessTimer.h:
(Client):
* UIProcess/WebLoaderClient.cpp:
(WebKit::WebLoaderClient::processDidBecomeUnresponsive):
(WebKit):
(WebKit::WebLoaderClient::interactionOccurredWhileProcessUnresponsive):
* UIProcess/WebLoaderClient.h:
(WebLoaderClient):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::interactionOccurredWhileProcessUnresponsive):
(WebKit):
* UIProcess/WebPageProxy.h:
(WebPageProxy):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::interactionOccurredWhileUnresponsive):
(WebKit):
* UIProcess/WebProcessProxy.h:
(WebProcessProxy):

Tools: Need a client callback for when the user tries to interact with an already unresponsive page
https://bugs.webkit.org/show_bug.cgi?id=84201
<rdar://problem/11140862>

Reviewed by Andreas Kling.

Add new client functions.

* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController awakeFromNib]):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114451 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ce314b09
2012-04-17 Anders Carlsson <andersca@apple.com>
Need a client callback for when the user tires to interact with an already unresponsive page
https://bugs.webkit.org/show_bug.cgi?id=84201
<rdar://problem/11140862>
Reviewed by Andreas Kling.
Add a interactionOccurredWhileProcessUnresponsive callback that's called when the unresponsiveness timer
fires while it's already unresponsive.
* UIProcess/API/C/WKPage.h:
* UIProcess/ResponsivenessTimer.cpp:
(WebKit):
(WebKit::ResponsivenessTimer::timerFired):
(WebKit::ResponsivenessTimer::start):
* UIProcess/ResponsivenessTimer.h:
(Client):
* UIProcess/WebLoaderClient.cpp:
(WebKit::WebLoaderClient::processDidBecomeUnresponsive):
(WebKit):
(WebKit::WebLoaderClient::interactionOccurredWhileProcessUnresponsive):
* UIProcess/WebLoaderClient.h:
(WebLoaderClient):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::interactionOccurredWhileProcessUnresponsive):
(WebKit):
* UIProcess/WebPageProxy.h:
(WebPageProxy):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::interactionOccurredWhileUnresponsive):
(WebKit):
* UIProcess/WebProcessProxy.h:
(WebProcessProxy):
2012-04-17 Anders Carlsson <andersca@apple.com>
 
Make sure that the layer hosting mode is kept up to date if it changes before the plug-in is initialized
......@@ -113,6 +113,8 @@ struct WKPageLoaderClient {
WKPageDidNewFirstVisuallyNonEmptyLayoutCallback didNewFirstVisuallyNonEmptyLayout;
WKPageWillGoToBackForwardListItemCallback willGoToBackForwardListItem;
WKPageCallback interactionOccurredWhileProcessUnresponsive;
};
typedef struct WKPageLoaderClient WKPageLoaderClient;
......
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
* Copyright (C) 2010, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -30,7 +30,7 @@ using namespace WebCore;
namespace WebKit {
static const double kResponsivenessTimeout = 3;
static const double responsivenessTimeout = 3;
ResponsivenessTimer::ResponsivenessTimer(ResponsivenessTimer::Client* client)
: m_client(client)
......@@ -51,13 +51,13 @@ void ResponsivenessTimer::invalidate()
void ResponsivenessTimer::timerFired()
{
// We'll never schedule the timer unless we're responsive.
ASSERT(m_isResponsive);
m_isResponsive = false;
m_client->didBecomeUnresponsive(this);
m_timer.stop();
if (m_isResponsive) {
m_isResponsive = false;
m_client->didBecomeUnresponsive(this);
} else {
// The timer fired while unresponsive.
m_client->interactionOccurredWhileUnresponsive(this);
}
}
void ResponsivenessTimer::start()
......@@ -65,10 +65,7 @@ void ResponsivenessTimer::start()
if (m_timer.isActive())
return;
if (!m_isResponsive)
return;
m_timer.startOneShot(kResponsivenessTimeout);
m_timer.startOneShot(responsivenessTimeout);
}
void ResponsivenessTimer::stop()
......
......@@ -36,6 +36,7 @@ public:
public:
virtual ~Client() { }
virtual void didBecomeUnresponsive(ResponsivenessTimer*) = 0;
virtual void interactionOccurredWhileUnresponsive(ResponsivenessTimer*) = 0;
virtual void didBecomeResponsive(ResponsivenessTimer*) = 0;
};
......
......@@ -211,6 +211,14 @@ void WebLoaderClient::processDidBecomeUnresponsive(WebPageProxy* page)
m_client.processDidBecomeUnresponsive(toAPI(page), m_client.clientInfo);
}
void WebLoaderClient::interactionOccurredWhileProcessUnresponsive(WebPageProxy* page)
{
if (!m_client.interactionOccurredWhileProcessUnresponsive)
return;
m_client.interactionOccurredWhileProcessUnresponsive(toAPI(page), m_client.clientInfo);
}
void WebLoaderClient::processDidBecomeResponsive(WebPageProxy* page)
{
if (!m_client.processDidBecomeResponsive)
......
......@@ -78,6 +78,7 @@ public:
// FIXME: These three functions should not be part of this client.
void processDidBecomeUnresponsive(WebPageProxy*);
void interactionOccurredWhileProcessUnresponsive(WebPageProxy*);
void processDidBecomeResponsive(WebPageProxy*);
void processDidCrash(WebPageProxy*);
......
......@@ -3285,6 +3285,14 @@ void WebPageProxy::processDidBecomeUnresponsive()
m_loaderClient.processDidBecomeUnresponsive(this);
}
void WebPageProxy::interactionOccurredWhileProcessUnresponsive()
{
if (!isValid())
return;
m_loaderClient.interactionOccurredWhileProcessUnresponsive(this);
}
void WebPageProxy::processDidBecomeResponsive()
{
if (!isValid())
......
......@@ -536,6 +536,7 @@ public:
void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
void processDidBecomeUnresponsive();
void interactionOccurredWhileProcessUnresponsive();
void processDidBecomeResponsive();
void processDidCrash();
......
......@@ -395,6 +395,14 @@ void WebProcessProxy::didBecomeUnresponsive(ResponsivenessTimer*)
pages[i]->processDidBecomeUnresponsive();
}
void WebProcessProxy::interactionOccurredWhileUnresponsive(ResponsivenessTimer*)
{
Vector<RefPtr<WebPageProxy> > pages;
copyValuesToVector(m_pageMap, pages);
for (size_t i = 0, size = pages.size(); i < size; ++i)
pages[i]->interactionOccurredWhileProcessUnresponsive();
}
void WebProcessProxy::didBecomeResponsive(ResponsivenessTimer*)
{
Vector<RefPtr<WebPageProxy> > pages;
......
......@@ -158,8 +158,9 @@ private:
virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, bool& didHandleMessage);
// ResponsivenessTimer::Client
void didBecomeUnresponsive(ResponsivenessTimer*);
void didBecomeResponsive(ResponsivenessTimer*);
void didBecomeUnresponsive(ResponsivenessTimer*) OVERRIDE;
void interactionOccurredWhileUnresponsive(ResponsivenessTimer*) OVERRIDE;
void didBecomeResponsive(ResponsivenessTimer*) OVERRIDE;
// ProcessLauncher::Client
virtual void didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier);
......
2012-04-17 Anders Carlsson <andersca@apple.com>
Need a client callback for when the user tries to interact with an already unresponsive page
https://bugs.webkit.org/show_bug.cgi?id=84201
<rdar://problem/11140862>
Reviewed by Andreas Kling.
Add new client functions.
* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController awakeFromNib]):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
2012-04-17 Dirk Pranke <dpranke@chromium.org>
 
nrwt: handle stopping layout test helper after a ctrl-c cleanly on the chromium port
......@@ -610,6 +610,7 @@ - (void)awakeFromNib
didDetectXSSForFrame,
0, // didNewFirstVisuallyNonEmptyLayout
0, // willGoToBackForwardListItem
0, // interactionOccurredWhileProcessUnresponsive
};
WKPageSetPageLoaderClient(_webView.pageRef, &loadClient);
......
......@@ -411,6 +411,7 @@ void TestController::initialize(int argc, const char* argv[])
0, // didDetectXSSForFrame
0, // didNewFirstVisuallyNonEmptyLayout
0, // willGoToBackForwardListItem
0, // interactionOccurredWhileProcessUnresponsive
};
WKPageSetPageLoaderClient(m_mainWebView->page(), &pageLoaderClient);
}
......
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