зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1892660 - Add a metric for async stylesheet load time. r=jesup
Differential Revision: https://phabricator.services.mozilla.com/D208660
This commit is contained in:
Родитель
3de6ea663a
Коммит
9a1e1392e3
|
@ -29,6 +29,22 @@ performance.pageload:
|
|||
- perf-telemetry-alerts@mozilla.com
|
||||
expires: never
|
||||
|
||||
async_sheet_load:
|
||||
type: timing_distribution
|
||||
time_unit: millisecond
|
||||
description: >
|
||||
Time spent in milliseconds since a style sheet started loading async
|
||||
until it finished.
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1892660
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1892660
|
||||
data_sensitivity:
|
||||
- technical
|
||||
notification_emails:
|
||||
- emilio@mozilla.com
|
||||
- perf-telemetry-alerts@mozilla.com
|
||||
expires: 132
|
||||
|
||||
performance.responsiveness:
|
||||
req_anim_frame_callback:
|
||||
|
|
|
@ -18,12 +18,11 @@
|
|||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/glean/GleanMetrics.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/PreloadHashKey.h"
|
||||
#include "mozilla/ResultExtensions.h"
|
||||
#include "mozilla/SchedulerGroup.h"
|
||||
#include "mozilla/URLPreloader.h"
|
||||
#include "nsIChildChannel.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsISupportsPriority.h"
|
||||
#include "nsITimedChannel.h"
|
||||
|
@ -47,8 +46,6 @@
|
|||
#include "nsMimeTypes.h"
|
||||
#include "nsICSSLoaderObserver.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIThreadInternal.h"
|
||||
#include "nsINetworkPredictor.h"
|
||||
#include "nsQueryActor.h"
|
||||
#include "nsStringStream.h"
|
||||
|
@ -62,13 +59,10 @@
|
|||
#include "mozilla/StyleSheet.h"
|
||||
#include "mozilla/StyleSheetInlines.h"
|
||||
#include "mozilla/ConsoleReportCollector.h"
|
||||
#include "mozilla/ServoUtils.h"
|
||||
#include "mozilla/css/StreamLoader.h"
|
||||
#include "mozilla/SharedStyleSheetCache.h"
|
||||
#include "mozilla/StaticPrefs_layout.h"
|
||||
#include "mozilla/StaticPrefs_network.h"
|
||||
#include "mozilla/StaticPrefs_dom.h"
|
||||
#include "mozilla/StaticPrefs_network.h"
|
||||
#include "mozilla/Try.h"
|
||||
#include "ReferrerInfo.h"
|
||||
|
||||
|
@ -417,6 +411,23 @@ SheetLoadData::~SheetLoadData() {
|
|||
"dropping the load");
|
||||
}
|
||||
|
||||
void SheetLoadData::StartLoading() {
|
||||
MOZ_ASSERT(!mIsLoading, "Already loading? How?");
|
||||
mIsLoading = true;
|
||||
mLoadStart = TimeStamp::Now();
|
||||
}
|
||||
|
||||
void SheetLoadData::SetLoadCompleted() {
|
||||
MOZ_ASSERT(mIsLoading, "Not loading?");
|
||||
MOZ_ASSERT(!mLoadStart.IsNull());
|
||||
mIsLoading = false;
|
||||
// Belts and suspenders just in case.
|
||||
if (MOZ_LIKELY(!mLoadStart.IsNull())) {
|
||||
glean::performance_pageload::async_sheet_load.AccumulateRawDuration(
|
||||
TimeStamp::Now() - mLoadStart);
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<StyleSheet> SheetLoadData::ValueForCache() const {
|
||||
// We need to clone the sheet on insertion to the cache because otherwise the
|
||||
// stylesheets can keep full windows alive via either their JS wrapper, or via
|
||||
|
|
|
@ -239,6 +239,9 @@ class SheetLoadData final
|
|||
// listening for the load.
|
||||
bool mIntentionallyDropped = false;
|
||||
|
||||
// The start timestamp for the load.
|
||||
TimeStamp mLoadStart;
|
||||
|
||||
const bool mRecordErrors;
|
||||
|
||||
bool ShouldDefer() const { return mWasAlternate || !mMediaMatched; }
|
||||
|
@ -269,8 +272,9 @@ class SheetLoadData final
|
|||
bool IsLoading() const override { return mIsLoading; }
|
||||
bool IsCancelled() const override { return mIsCancelled; }
|
||||
|
||||
void StartLoading() override { mIsLoading = true; }
|
||||
void SetLoadCompleted() override { mIsLoading = false; }
|
||||
void StartLoading() override;
|
||||
void SetLoadCompleted() override;
|
||||
|
||||
void Cancel() override { mIsCancelled = true; }
|
||||
|
||||
private:
|
||||
|
|
Загрузка…
Ссылка в новой задаче