Bug 1296625 - Replace query to ui.use_activity_cursor pref with a cached bool value. r=smaug

MozReview-Commit-ID: GeTr29JG4qy
This commit is contained in:
Xidorn Quan
2016-08-20 00:43:01 +10:00
parent 9f4e5989af
commit 08d2f6f5b6
4 changed files with 16 additions and 3 deletions

View File

@@ -7369,7 +7369,7 @@ nsDocShell::OnStateChange(nsIWebProgress* aProgress, nsIRequest* aRequest,
if ((aStateFlags & STATE_RESTORING) == 0) { if ((aStateFlags & STATE_RESTORING) == 0) {
// Show the progress cursor if the pref is set // Show the progress cursor if the pref is set
if (Preferences::GetBool("ui.use_activity_cursor", false)) { if (nsContentUtils::UseActivityCursor()) {
nsCOMPtr<nsIWidget> mainWidget; nsCOMPtr<nsIWidget> mainWidget;
GetMainWidget(getter_AddRefs(mainWidget)); GetMainWidget(getter_AddRefs(mainWidget));
if (mainWidget) { if (mainWidget) {
@@ -7385,7 +7385,7 @@ nsDocShell::OnStateChange(nsIWebProgress* aProgress, nsIRequest* aRequest,
mBusyFlags = BUSY_FLAGS_NONE; mBusyFlags = BUSY_FLAGS_NONE;
// Hide the progress cursor if the pref is set // Hide the progress cursor if the pref is set
if (Preferences::GetBool("ui.use_activity_cursor", false)) { if (nsContentUtils::UseActivityCursor()) {
nsCOMPtr<nsIWidget> mainWidget; nsCOMPtr<nsIWidget> mainWidget;
GetMainWidget(getter_AddRefs(mainWidget)); GetMainWidget(getter_AddRefs(mainWidget));
if (mainWidget) { if (mainWidget) {

View File

@@ -282,6 +282,7 @@ bool nsContentUtils::sGettersDecodeURLHash = false;
bool nsContentUtils::sPrivacyResistFingerprinting = false; bool nsContentUtils::sPrivacyResistFingerprinting = false;
bool nsContentUtils::sSendPerformanceTimingNotifications = false; bool nsContentUtils::sSendPerformanceTimingNotifications = false;
bool nsContentUtils::sAppendLFInSerialization = false; bool nsContentUtils::sAppendLFInSerialization = false;
bool nsContentUtils::sUseActivityCursor = false;
uint32_t nsContentUtils::sHandlingInputTimeout = 1000; uint32_t nsContentUtils::sHandlingInputTimeout = 1000;
@@ -606,6 +607,9 @@ nsContentUtils::Init()
Preferences::AddBoolVarCache(&sDoNotTrackEnabled, Preferences::AddBoolVarCache(&sDoNotTrackEnabled,
"privacy.donottrackheader.enabled", false); "privacy.donottrackheader.enabled", false);
Preferences::AddBoolVarCache(&sUseActivityCursor,
"ui.use_activity_cursor", false);
Element::InitCCCallbacks(); Element::InitCCCallbacks();
nsCOMPtr<nsIUUIDGenerator> uuidGenerator = nsCOMPtr<nsIUUIDGenerator> uuidGenerator =

View File

@@ -2062,6 +2062,14 @@ public:
return sPrivacyResistFingerprinting; return sPrivacyResistFingerprinting;
} }
/**
* Returns true if the browser should show busy cursor when loading page.
*/
static bool UseActivityCursor()
{
return sUseActivityCursor;
}
/** /**
* Return true if this doc is controlled by a ServiceWorker. * Return true if this doc is controlled by a ServiceWorker.
*/ */
@@ -2781,6 +2789,7 @@ private:
static bool sPrivacyResistFingerprinting; static bool sPrivacyResistFingerprinting;
static bool sSendPerformanceTimingNotifications; static bool sSendPerformanceTimingNotifications;
static bool sAppendLFInSerialization; static bool sAppendLFInSerialization;
static bool sUseActivityCursor;
static uint32_t sCookiesLifetimePolicy; static uint32_t sCookiesLifetimePolicy;
static uint32_t sCookiesBehavior; static uint32_t sCookiesBehavior;

View File

@@ -3567,7 +3567,7 @@ EventStateManager::UpdateCursor(nsPresContext* aPresContext,
hotspotY = framecursor.mHotspotY; hotspotY = framecursor.mHotspotY;
} }
if (Preferences::GetBool("ui.use_activity_cursor", false)) { if (nsContentUtils::UseActivityCursor()) {
// Check whether or not to show the busy cursor // Check whether or not to show the busy cursor
nsCOMPtr<nsIDocShell> docShell(aPresContext->GetDocShell()); nsCOMPtr<nsIDocShell> docShell(aPresContext->GetDocShell());
if (!docShell) return; if (!docShell) return;