Some pages either have tons of subframes or dynamically add lots of plugins. We're currently wasting a lot of time on every subframe load and every addPluginView doing primary plugin detection. Some things we can do to improve this: * only start detecting after the main frame's didFinishLoad comes. This was intended to be in the original implementation, but we only wait for the first subframe's didFinishLoad instead :| * only explicitly detect on the main frame's didFinishLoad (not subframes) * coalesce calls to determinePrimarySnapshottedPlugInTimerFired from both addPluginView (in case JS is adding lots of plugins in a loop) and didFinishLoad I'm not sure this is a 100% solution, but it should not regress primary plugin detection while improving performance greatly on some pages (http://thelede.blogs.nytimes.com/2013/04/19/updates-on-aftermath-of-boston-marathon-explosions-2/). <rdar://problem/13696269>
Created attachment 199117 [details] patch
Going to test more before landing.
Comment on attachment 199117 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=199117&action=review > Source/WebKit2/WebProcess/WebPage/WebPage.cpp:3949 > +void WebPage::determinePrimarySnapshottedPlugInTimerFired() > +{ > +#if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC) > + if (!m_page->settings()->snapshotAllPlugIns() && m_page->settings()->primaryPlugInSnapshotDetectionEnabled()) > + determinePrimarySnapshottedPlugIn(); > +#endif > +} You probably want to put the entire function body inside the #if.
https://trac.webkit.org/changeset/148919