Make Page::setDefersLoading() have a call count so that each time
authorjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 May 2012 01:39:16 +0000 (01:39 +0000)
committerjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 May 2012 01:39:16 +0000 (01:39 +0000)
commit2258e004f6875602a2eb0cb12c94a85b92db9809
tree9a5791db9edbcbd11bfd0db3a62d05fa17bba1b4
parent9a7507d912f4dedd1c819f4d92953480d55afd24
Make Page::setDefersLoading() have a call count so that each time
loading is deferred, it must be balanced with a call to resume.
https://bugs.webkit.org/show_bug.cgi?id=84522

Reviewed by Andy Estes.

Source/WebCore:

* page/Page.cpp:
(WebCore::Page::Page):
Initialize new call count member.
(WebCore::Page::setDefersLoading):
Check whether the callers wants balanced defer/resume loading behavior.
If the call count is not changing from 0 to 1 or 1 to 0, return early.
Otherwise, defer or resume loading for frames in this page.

* page/Page.h:
(WebCore::Page::defersLoading):
Added a member to hold the call count.

* page/Settings.cpp:
(WebCore::Settings::Settings):
Initialized new member m_wantsBalancedSetDefersLoadingBehavior.

* page/Settings.h:
(Settings):
Added new member m_wantsBalancedSetDefersLoadingBehavior.
(WebCore::Settings::setWantsBalancedSetDefersLoadingBehavior):
Setter.
(WebCore::Settings::wantsBalancedSetDefersLoadingBehavior):
Getter.

Source/WebKit/mac:

* WebView/WebPreferenceKeysPrivate.h:
Declare a new key for this preference.

* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
Initialize new preference to NO.
(-[WebPreferences setWantsBalancedSetDefersLoadingBehavior:]):
Setter.
(-[WebPreferences wantsBalancedSetDefersLoadingBehavior]):
Getter.

* WebView/WebPreferencesPrivate.h:
Declare setter and getter.

* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
Set the setting from the WebPreferences object's value.

Source/WebKit2:

* Shared/WebPreferencesStore.h:
Use the macro to declare the new preference.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
Set the setting from the WebPreferencesStore's value.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@115925 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKit/mac/WebView/WebPreferences.mm
Source/WebKit/mac/WebView/WebPreferencesPrivate.h
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesStore.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp