Changeset 83375 in webkit


Ignore:
Timestamp:
Apr 9, 2011 1:01:20 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-04-09 Sreeram Ramachandran <sreeram@google.com>

Reviewed by Ryosuke Niwa.

Gather data on modal dialogs shown during unload events
https://bugs.webkit.org/show_bug.cgi?id=58115

Add a new method to the ChromeClient API to allow clients to receive
notifications of modal dialogs dispatched during page dismissal events.
The new method has a default empty definition; only chromium overrides
it to keep track of histograms.

No tests because this is a no-op for all ports except chromium (and it's
not clear how to test chromium histograms from webkit).

  • page/Chrome.cpp: (WebCore::isDuringPageDismissal): (WebCore::willRunModalDialog): (WebCore::Chrome::runJavaScriptAlert): (WebCore::Chrome::runJavaScriptConfirm): (WebCore::Chrome::runJavaScriptPrompt): (WebCore::Chrome::willRunModalHTMLDialog):
  • page/Chrome.h:
  • page/ChromeClient.h: (WebCore::ChromeClient::willRunModalDialogDuringPageDismissal):
  • page/DOMWindow.cpp: (WebCore::DOMWindow::showModalDialog):

2011-04-09 Sreeram Ramachandran <sreeram@google.com>

Reviewed by Ryosuke Niwa.

Gather data on modal dialogs shown during unload events
https://bugs.webkit.org/show_bug.cgi?id=58115

Implementation of the new API to receive notifications of modal dialogs
dispatched during unload events. Count the notifications through a histogram.

No tests because it's not clear how to test chromium histograms from webkit.

  • src/ChromeClientImpl.cpp: (WebKit::ChromeClientImpl::willRunModalDialogDuringPageDismissal):
  • src/ChromeClientImpl.h:
Location:
trunk/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r83373 r83375  
     12011-04-09  Sreeram Ramachandran  <sreeram@google.com>
     2
     3        Reviewed by Ryosuke Niwa.
     4
     5        Gather data on modal dialogs shown during unload events
     6        https://bugs.webkit.org/show_bug.cgi?id=58115
     7
     8        Add a new method to the ChromeClient API to allow clients to receive
     9        notifications of modal dialogs dispatched during page dismissal events.
     10        The new method has a default empty definition; only chromium overrides
     11        it to keep track of histograms.
     12
     13        No tests because this is a no-op for all ports except chromium (and it's
     14        not clear how to test chromium histograms from webkit).
     15
     16        * page/Chrome.cpp:
     17        (WebCore::isDuringPageDismissal):
     18        (WebCore::willRunModalDialog):
     19        (WebCore::Chrome::runJavaScriptAlert):
     20        (WebCore::Chrome::runJavaScriptConfirm):
     21        (WebCore::Chrome::runJavaScriptPrompt):
     22        (WebCore::Chrome::willRunModalHTMLDialog):
     23        * page/Chrome.h:
     24        * page/ChromeClient.h:
     25        (WebCore::ChromeClient::willRunModalDialogDuringPageDismissal):
     26        * page/DOMWindow.cpp:
     27        (WebCore::DOMWindow::showModalDialog):
     28
    1292011-04-08  David Humphrey  <david.humphrey@senecac.on.ca>
    230
  • trunk/Source/WebCore/page/Chrome.cpp

    r80716 r83375  
    281281}
    282282
     283static inline void willRunModalDialog(const Frame* frame, const ChromeClient::DialogType& dialogType, const ChromeClient* client)
     284{
     285    if (frame->loader()->pageDismissalEventBeingDispatched())
     286        client->willRunModalDialogDuringPageDismissal(dialogType);
     287}
     288
    283289void Chrome::runJavaScriptAlert(Frame* frame, const String& message)
    284290{
     291    willRunModalDialog(frame, ChromeClient::AlertDialog, m_client);
     292
    285293    // Defer loads in case the client method runs a new event loop that would
    286294    // otherwise cause the load to continue while we're in the middle of executing JavaScript.
     
    293301bool Chrome::runJavaScriptConfirm(Frame* frame, const String& message)
    294302{
     303    willRunModalDialog(frame, ChromeClient::ConfirmDialog, m_client);
     304
    295305    // Defer loads in case the client method runs a new event loop that would
    296306    // otherwise cause the load to continue while we're in the middle of executing JavaScript.
     
    303313bool Chrome::runJavaScriptPrompt(Frame* frame, const String& prompt, const String& defaultValue, String& result)
    304314{
     315    willRunModalDialog(frame, ChromeClient::PromptDialog, m_client);
     316
    305317    // Defer loads in case the client method runs a new event loop that would
    306318    // otherwise cause the load to continue while we're in the middle of executing JavaScript.
     
    548560}
    549561
     562void Chrome::willRunModalHTMLDialog(const Frame* frame) const
     563{
     564    willRunModalDialog(frame, ChromeClient::HTMLDialog, m_client);
     565}
     566
    550567} // namespace WebCore
  • trunk/Source/WebCore/page/Chrome.h

    r80716 r83375  
    176176#endif
    177177
     178        void willRunModalHTMLDialog(const Frame*) const;
     179
    178180    private:
    179181        Page* m_page;
  • trunk/Source/WebCore/page/ChromeClient.h

    r82084 r83375  
    304304        virtual void didCompleteRubberBandForMainFrame(const IntSize&) const { }
    305305
     306        enum DialogType {
     307            AlertDialog = 0,
     308            ConfirmDialog = 1,
     309            PromptDialog = 2,
     310            HTMLDialog = 3,
     311            NumDialogTypes = 4
     312        };
     313        virtual void willRunModalDialogDuringPageDismissal(const DialogType&) const { }
     314
    306315    protected:
    307316        virtual ~ChromeClient() { }
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r81932 r83375  
    18391839        return;
    18401840
     1841    if (m_frame->page())
     1842        m_frame->page()->chrome()->willRunModalHTMLDialog(m_frame);
     1843
    18411844    if (!canShowModalDialogNow(m_frame) || !firstWindow->allowPopUp())
    18421845        return;
  • trunk/Source/WebKit/chromium/ChangeLog

    r83366 r83375  
     12011-04-09  Sreeram Ramachandran  <sreeram@google.com>
     2
     3        Reviewed by Ryosuke Niwa.
     4
     5        Gather data on modal dialogs shown during unload events
     6        https://bugs.webkit.org/show_bug.cgi?id=58115
     7
     8        Implementation of the new API to receive notifications of modal dialogs
     9        dispatched during unload events. Count the notifications through a histogram.
     10
     11        No tests because it's not clear how to test chromium histograms from webkit.
     12
     13        * src/ChromeClientImpl.cpp:
     14        (WebKit::ChromeClientImpl::willRunModalDialogDuringPageDismissal):
     15        * src/ChromeClientImpl.h:
     16
    1172011-04-08  Aaron Boodman  <aa@chromium.org>
    218
  • trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp

    r82221 r83375  
    5555#include "NotificationPresenterImpl.h"
    5656#include "Page.h"
     57#include "PlatformBridge.h"
    5758#include "PopupMenuChromium.h"
    5859#include "RenderWidget.h"
     
    906907}
    907908
     909void ChromeClientImpl::willRunModalDialogDuringPageDismissal(const DialogType& dialogType) const
     910{
     911    PlatformBridge::histogramEnumeration("Renderer.ModalDialogsDuringPageDismissal", static_cast<int>(dialogType), static_cast<int>(NumDialogTypes));
     912}
     913
    908914} // namespace WebKit
  • trunk/Source/WebKit/chromium/src/ChromeClientImpl.h

    r82221 r83375  
    192192#endif
    193193
     194    virtual void willRunModalDialogDuringPageDismissal(const DialogType&) const;
     195
    194196private:
    195197    void getPopupMenuInfo(WebCore::PopupContainer*, WebPopupMenuInfo*);
Note: See TracChangeset for help on using the changeset viewer.