Bug 92538 - Add diagnostic logging for plugins-per-page.
Summary: Add diagnostic logging for plugins-per-page.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jer Noble
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-27 12:43 PDT by Jer Noble
Modified: 2012-07-30 17:43 PDT (History)
3 users (show)

See Also:


Attachments
Patch (7.79 KB, patch)
2012-07-27 12:48 PDT, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (10.40 KB, patch)
2012-07-27 15:36 PDT, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (10.86 KB, patch)
2012-07-27 15:48 PDT, Jer Noble
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jer Noble 2012-07-27 12:43:41 PDT
Add diagnostic logging for plugins-per-page.
Comment 1 Jer Noble 2012-07-27 12:48:17 PDT
Created attachment 155027 [details]
Patch
Comment 2 Anders Carlsson 2012-07-27 13:44:26 PDT
Comment on attachment 155027 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=155027&action=review

> Source/WebCore/html/HTMLEmbedElement.cpp:190
> +    if (document()->page() && document()->page()->settings()->diagnosticLoggingEnabled()) {
> +        Page* page = document()->page();
> +        ChromeClient* client = page->chrome()->client();
> +        client->logDiagnosticMessage(success ? DiagnosticLoggingKeys::pluginLoadedKey() : DiagnosticLoggingKeys::pluginLoadingFailedKey(), m_serviceType, DiagnosticLoggingKeys::noopKey());
> +        if (!page->hasSeenAnyPlugin())
> +            client->logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsAtLeastOnePluginKey(), emptyString(), DiagnosticLoggingKeys::noopKey());
> +        if (!page->hasSeenPlugin(m_serviceType))
> +            client->logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsPluginKey(), m_serviceType, DiagnosticLoggingKeys::noopKey());
> +        page->sawPlugin(m_serviceType);
> +    }

I think this code can be moved into a function in HTMLPluginImageElement and shared between HTMLEmbedElement and HTMLObjectElement. You also need to do the same thing now for HTMLAppletElement. You also want to null check page.
Comment 3 Jer Noble 2012-07-27 14:21:44 PDT
(In reply to comment #2)
> (From update of attachment 155027 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=155027&action=review
> 
> > Source/WebCore/html/HTMLEmbedElement.cpp:190
> > +    if (document()->page() && document()->page()->settings()->diagnosticLoggingEnabled()) {
> > +        Page* page = document()->page();
> > +        ChromeClient* client = page->chrome()->client();
> > +        client->logDiagnosticMessage(success ? DiagnosticLoggingKeys::pluginLoadedKey() : DiagnosticLoggingKeys::pluginLoadingFailedKey(), m_serviceType, DiagnosticLoggingKeys::noopKey());
> > +        if (!page->hasSeenAnyPlugin())
> > +            client->logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsAtLeastOnePluginKey(), emptyString(), DiagnosticLoggingKeys::noopKey());
> > +        if (!page->hasSeenPlugin(m_serviceType))
> > +            client->logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsPluginKey(), m_serviceType, DiagnosticLoggingKeys::noopKey());
> > +        page->sawPlugin(m_serviceType);
> > +    }
> 
> I think this code can be moved into a function in HTMLPluginImageElement and shared between HTMLEmbedElement and HTMLObjectElement. You also need to do the same thing now for HTMLAppletElement.

Sure thing.

> You also want to null check page.

Page gets null checked on the first line, but yes. :)
Comment 4 Jer Noble 2012-07-27 15:36:25 PDT
Created attachment 155069 [details]
Patch

Moved logging into SubframeLoader to catch all plugin subtypes, including HTMLAppletElement.
Comment 5 Jer Noble 2012-07-27 15:48:27 PDT
Created attachment 155074 [details]
Patch

Now with more applets!
Comment 6 Jer Noble 2012-07-27 15:58:11 PDT
Committed r123930: <http://trac.webkit.org/changeset/123930>
Comment 7 Darin Adler 2012-07-30 17:43:02 PDT
Comment on attachment 155074 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=155074&action=review

> Source/WebCore/page/Page.cpp:1174
> +bool Page::hasSeenPlugin(const String& serviceType) const
> +{
> +    return m_seenPlugins.contains(serviceType);
> +}
> +
> +void Page::sawPlugin(const String& serviceType)
> +{
> +    m_seenPlugins.add(serviceType);
> +}

Do we have a guarantee that serviceType won’t be the empty string or null?