Split UserActivity/CountedUserActivity
https://bugs.webkit.org/show_bug.cgi?id=129520

Reviewed by Sam Weinig.

UserActivity currently provides an interface allowing counted, nested calls to enable/disable.
In some cases it would be easier to use if it were a simpler boolean enabled/disabled interface.

Source/WebCore: 

* WebCore.exp.in:
    - beginActivity->start, endActivity->stop.
* WebCore.xcodeproj/project.pbxproj:
* page/PageThrottler.cpp:
(WebCore::PageThrottler::PageThrottler):
(WebCore::PageThrottler::~PageThrottler):
(WebCore::PageThrottler::throttlePage):
(WebCore::PageThrottler::unthrottlePage):
(WebCore::PageThrottler::setIsVisuallyIdle):
    - beginActivity->increment, endActivity->decrement.
* page/PageThrottler.h:
    - UserActivity->CountedUserActivity for m_pageActivity
* platform/CountedUserActivity.h: Copied from Source/WebCore/platform/UserActivity.h.
(WebCore::CountedUserActivity::CountedUserActivity):
(WebCore::CountedUserActivity::increment):
(WebCore::CountedUserActivity::decrement):
    - Added, provides counted interface to UserActivity.
* platform/UserActivity.cpp:
(WebCore::UserActivity::UserActivity):
    - m_count removed
(WebCore::UserActivity::start):
(WebCore::UserActivity::stop):
    - beginActivity->start, endActivity->stop, implentation now empty.
* platform/UserActivity.h:
    - beginActivity->start, endActivity->stop, m_count moved to HAVE(NS_ACTIVITY)
* platform/mac/UserActivityMac.mm:
(WebCore::UserActivity::UserActivity):
    - m_count->m_started
(WebCore::UserActivity::isValid):
    - m_count->m_started
(WebCore::UserActivity::start):
(WebCore::UserActivity::stop):
    - beginActivity->start, endActivity->stop, no longer nest

Source/WebKit2: 

* PluginProcess/PluginProcess.h:
(WebKit::PluginProcess::connectionActivity):
    - UserActivity->CountedUserActivity
* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::PluginProcess::platformInitializeProcess):
    - beginActivity->start
* Shared/ActivityAssertion.cpp:
(WebKit::ActivityAssertion::ActivityAssertion):
(WebKit::ActivityAssertion::~ActivityAssertion):
    - beginActivity->increment, endActivity->decrement.
* Shared/ActivityAssertion.h:
    - UserActivity->CountedUserActivity
* Shared/ChildProcess.cpp:
(WebKit::ChildProcess::setProcessSuppressionEnabled):
    - beginActivity->start, endActivity->stop.
* Shared/ChildProcess.h:
    - removed processSuppressionEnabled()
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
    - beginActivity->start, endActivity->stop.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164913 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change PageActivityAssertionToken to use a WeakPtr
https://bugs.webkit.org/show_bug.cgi?id=129526

Reviewed by Sam Weinig.

PageThrottler effectively implements a bespoke weak pointer mechanism; remove this & just use WeakPtr.

* page/PageActivityAssertionToken.cpp:
(WebCore::PageActivityAssertionToken::PageActivityAssertionToken):
(WebCore::PageActivityAssertionToken::~PageActivityAssertionToken):
    - addActivityToken->incrementActivityCount, removeActivityToken->decrementActivityCount
* page/PageActivityAssertionToken.h:
    - removed invalidate, made m_throttler a WeakPtr
* page/PageThrottler.cpp:
(WebCore::PageThrottler::PageThrottler):
    - initialize m_weakPtrFactory, m_activityCount.
(WebCore::PageThrottler::~PageThrottler):
    - removed called to invalidate.
(WebCore::PageThrottler::startThrottleHysteresisTimer):
    - m_activityTokens.size()->m_activityCount
(WebCore::PageThrottler::throttleHysteresisTimerFired):
    - m_activityTokens.size()->m_activityCount
(WebCore::PageThrottler::incrementActivityCount):
    - m_activityTokens.add->++
(WebCore::PageThrottler::decrementActivityCount):
    - m_activityTokens.remove->--
* page/PageThrottler.h:
(WebCore::PageThrottler::weakPtr):
    - replaced HashSet with WeakPtrFactory & count.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164914 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed follow-up to r164905 and r164912.

* Platform/IPC/Connection.h: Only declare setShouldCloseConnectionOnMachExceptions() for the Mac port.
* UIProcess/Plugins/PluginProcessProxy.cpp:
(WebKit::PluginProcessProxy::didFinishLaunching): Only call setShouldCloseConnectionOnMachExceptions() on the Mac port.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164915 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed build fix after r164913.

* platform/CountedUserActivity.h: Some ports don't (yet) support forwarding headers for WebCore,
so UserActivity.h should be included as non-forwarding.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164916 268f45cc-cd09-0410-ab3c-d52691b4dbfc