Ignore:
Timestamp:
Sep 17, 2014, 11:27:42 AM (11 years ago)
Author:
[email protected]
Message:

Aways have a PageThrottler (sometimes have a UserActivity::Impl)
https://bugs.webkit.org/show_bug.cgi?id=136892

Reviewed by Geoffrey Garen.

Some instances of Page have a PageThrottler to track activity on the Page, and some do not.
(Specifically, those created from WebPage in WK2 do, those related to WK1, SVG & inspector do not).

We do this for three reasons:

  • We do not need to take AppNap assertions on WK1.
  • Some Pages do not track their visibility correctly, and would always claim to be visible.
  • Page VisibilityState is not set until after construction, so if we instantiate

Creating the entire PageThrottler lazily has the drawback that we have to check for its existence at
numerous points throughout the code, and we'll miss activity that occurs between the Page being created
& the PageThrottler added to it (really a theoretical problem right now, since they're currently always
created pretty much back to back).

Instead, Page should always have a PageThrottler, & instead make the UserActivity::Impl on the
PageThrottler be added later.

Source/WebCore:

  • WebCore.exp.in:
    • createPageThrottler -> enablePageThrottler
  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::parseAttribute):

  • Page::pageThrottler now returns a reference rather than a pointer
  • loader/FrameLoader.cpp:

(WebCore::FrameLoader::started):

  • Page::pageThrottler now returns a reference rather than a pointer
  • page/Page.cpp:

(WebCore::Page::Page):

  • instantiate PageThrottler in constructor

(WebCore::Page::enablePageThrottler):

  • renamed from createPageThrottler, instead of creating the PageThrottler this method now instruct PageThrottler to create a UserActivity::Impl

(WebCore::Page::setViewState):

  • m_pageThrottler is not a pointer

(WebCore::Page::createPageThrottler): Deleted.

  • renamed to enablePageThrottler
  • page/Page.h:

(WebCore::Page::pageThrottler):

  • now returns a reference
  • page/PageThrottler.cpp:

(WebCore::PageThrottler::PageThrottler):

  • no longer instantiate m_activity

(WebCore::PageThrottler::createUserActivity):

  • lazily instantiate m_activity, call updateUserActivity

(WebCore::PageThrottler::updateUserActivity):

  • m_activity may not yet be instantiated; added early return
  • page/PageThrottler.h:
    • m_activity becomes a std::unique_ptr, added createUserActivity

Source/WebKit2:

  • WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:

(WebKit::NPRuntimeObjectMap::evaluate):

  • createPageThrottler -> enablePageThrottler
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::WebPage):
(WebKit::WebPage::mouseEvent):
(WebKit::WebPage::wheelEvent):
(WebKit::WebPage::keyEvent):

  • Page::pageThrottler now returns a reference rather than a pointer
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp

    r173694 r173696  
    193193    if (m_pluginView && !m_pluginView->isBeingDestroyed()) {
    194194        if (Page* page = m_pluginView->frame()->page()) {
    195             if (m_pluginView->audioHardwareActivity() != WebCore::AudioHardwareActivityType::IsInactive && page->pageThrottler())
    196                 page->pageThrottler()->pluginDidEvaluateWhileAudioIsPlaying();
     195            if (m_pluginView->audioHardwareActivity() != WebCore::AudioHardwareActivityType::IsInactive)
     196                page->pageThrottler().pluginDidEvaluateWhileAudioIsPlaying();
    197197        }
    198198    }
Note: See TracChangeset for help on using the changeset viewer.