Loading content/base/src/nsContentSink.cpp +10 −6 Original line number Diff line number Diff line Loading @@ -298,6 +298,11 @@ nsContentSink::Init(nsIDocument* aDoc, mCanInterruptParser = nsContentUtils::GetBoolPref("content.interrupt.parsing", PR_TRUE); // 200 determined empirically to provide good user response without // sampling the clock too often. mMaxTokensDeflectedInLowFreqMode = nsContentUtils::GetIntPref("content.max.deflected.tokens", 200); return NS_OK; } Loading Loading @@ -1538,23 +1543,22 @@ nsContentSink::DidProcessATokenImpl() // If we can't get the last input time from the widget // then we will get it from the viewmanager. rv = vm->GetLastUserEventTime(eventTime); NS_ENSURE_SUCCESS(rv , NS_ERROR_FAILURE); } NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); if (!mDynamicLowerValue && mLastSampledUserEventTime == eventTime) { // The magic value of NS_MAX_TOKENS_DEFLECTED_IN_LOW_FREQ_MODE // The default value of mMaxTokensDeflectedInLowFreqMode (200) // was selected by empirical testing. It provides reasonable // user response and prevents us from sampling the clock too // frequently. if (mDeflectedCount < NS_MAX_TOKENS_DEFLECTED_IN_LOW_FREQ_MODE) { // frequently. This value may be decreased if responsiveness is // valued more than end-to-end pageload time (e.g., for mobile). if (mDeflectedCount < mMaxTokensDeflectedInLowFreqMode) { mDeflectedCount++; // return early to prevent sampling the clock. Note: This // prevents us from switching to higher frequency (better UI // responsive) mode, so limit ourselves to doing for no more // than NS_MAX_TOKENS_DEFLECTED_IN_LOW_FREQ_MODE tokens. // than mMaxTokensDeflectedInLowFreqMode tokens. return NS_OK; } Loading content/base/src/nsContentSink.h +2 −4 Original line number Diff line number Diff line Loading @@ -107,10 +107,6 @@ extern PRLogModuleInfo* gContentSinkLogModuleInfo; // 1/2 second fudge factor for window creation #define NS_DELAY_FOR_WINDOW_CREATION 500000 // 200 determined empirically to provide good user response without // sampling the clock too often. #define NS_MAX_TOKENS_DEFLECTED_IN_LOW_FREQ_MODE 200 class nsContentSink : public nsICSSLoaderObserver, public nsIScriptLoaderObserver, public nsSupportsWeakReference, Loading Loading @@ -363,6 +359,8 @@ protected: // Switch between intervals when time is exceeded PRInt32 mDynamicIntervalSwitchThreshold; PRInt32 mMaxTokensDeflectedInLowFreqMode; PRInt32 mBeginLoadTime; // Last mouse event or keyboard event time sampled by the content Loading Loading
content/base/src/nsContentSink.cpp +10 −6 Original line number Diff line number Diff line Loading @@ -298,6 +298,11 @@ nsContentSink::Init(nsIDocument* aDoc, mCanInterruptParser = nsContentUtils::GetBoolPref("content.interrupt.parsing", PR_TRUE); // 200 determined empirically to provide good user response without // sampling the clock too often. mMaxTokensDeflectedInLowFreqMode = nsContentUtils::GetIntPref("content.max.deflected.tokens", 200); return NS_OK; } Loading Loading @@ -1538,23 +1543,22 @@ nsContentSink::DidProcessATokenImpl() // If we can't get the last input time from the widget // then we will get it from the viewmanager. rv = vm->GetLastUserEventTime(eventTime); NS_ENSURE_SUCCESS(rv , NS_ERROR_FAILURE); } NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); if (!mDynamicLowerValue && mLastSampledUserEventTime == eventTime) { // The magic value of NS_MAX_TOKENS_DEFLECTED_IN_LOW_FREQ_MODE // The default value of mMaxTokensDeflectedInLowFreqMode (200) // was selected by empirical testing. It provides reasonable // user response and prevents us from sampling the clock too // frequently. if (mDeflectedCount < NS_MAX_TOKENS_DEFLECTED_IN_LOW_FREQ_MODE) { // frequently. This value may be decreased if responsiveness is // valued more than end-to-end pageload time (e.g., for mobile). if (mDeflectedCount < mMaxTokensDeflectedInLowFreqMode) { mDeflectedCount++; // return early to prevent sampling the clock. Note: This // prevents us from switching to higher frequency (better UI // responsive) mode, so limit ourselves to doing for no more // than NS_MAX_TOKENS_DEFLECTED_IN_LOW_FREQ_MODE tokens. // than mMaxTokensDeflectedInLowFreqMode tokens. return NS_OK; } Loading
content/base/src/nsContentSink.h +2 −4 Original line number Diff line number Diff line Loading @@ -107,10 +107,6 @@ extern PRLogModuleInfo* gContentSinkLogModuleInfo; // 1/2 second fudge factor for window creation #define NS_DELAY_FOR_WINDOW_CREATION 500000 // 200 determined empirically to provide good user response without // sampling the clock too often. #define NS_MAX_TOKENS_DEFLECTED_IN_LOW_FREQ_MODE 200 class nsContentSink : public nsICSSLoaderObserver, public nsIScriptLoaderObserver, public nsSupportsWeakReference, Loading Loading @@ -363,6 +359,8 @@ protected: // Switch between intervals when time is exceeded PRInt32 mDynamicIntervalSwitchThreshold; PRInt32 mMaxTokensDeflectedInLowFreqMode; PRInt32 mBeginLoadTime; // Last mouse event or keyboard event time sampled by the content Loading