mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1186880 - Performance timing api in workers should output entries if preference is enabled. r=baku
This commit is contained in:
parent
79ef3ad1e1
commit
1fd630d522
@ -745,13 +745,7 @@ nsPerformance::InsertUserEntry(PerformanceEntry* aEntry)
|
||||
// If we have no URI, just put in "none".
|
||||
uri.AssignLiteral("none");
|
||||
}
|
||||
PERFLOG("Performance Entry: %s|%s|%s|%f|%f|%" PRIu64 "\n",
|
||||
uri.get(),
|
||||
NS_ConvertUTF16toUTF8(aEntry->GetEntryType()).get(),
|
||||
NS_ConvertUTF16toUTF8(aEntry->GetName()).get(),
|
||||
aEntry->StartTime(),
|
||||
aEntry->Duration(),
|
||||
static_cast<uint64_t>(PR_Now() / PR_USEC_PER_MSEC));
|
||||
PerformanceBase::LogEntry(aEntry, uri);
|
||||
}
|
||||
|
||||
PerformanceBase::InsertUserEntry(aEntry);
|
||||
@ -980,6 +974,18 @@ PerformanceBase::ClearMeasures(const Optional<nsAString>& aName)
|
||||
ClearUserEntries(aName, NS_LITERAL_STRING("measure"));
|
||||
}
|
||||
|
||||
void
|
||||
PerformanceBase::LogEntry(PerformanceEntry* aEntry, const nsACString& aOwner) const
|
||||
{
|
||||
PERFLOG("Performance Entry: %s|%s|%s|%f|%f|%" PRIu64 "\n",
|
||||
aOwner.BeginReading(),
|
||||
NS_ConvertUTF16toUTF8(aEntry->GetEntryType()).get(),
|
||||
NS_ConvertUTF16toUTF8(aEntry->GetName()).get(),
|
||||
aEntry->StartTime(),
|
||||
aEntry->Duration(),
|
||||
static_cast<uint64_t>(PR_Now() / PR_USEC_PER_MSEC));
|
||||
}
|
||||
|
||||
void
|
||||
PerformanceBase::InsertUserEntry(PerformanceEntry* aEntry)
|
||||
{
|
||||
|
@ -350,6 +350,8 @@ protected:
|
||||
return mResourceEntries.Length() >= mResourceTimingBufferSize;
|
||||
}
|
||||
|
||||
void LogEntry(PerformanceEntry* aEntry, const nsACString& aOwner) const;
|
||||
|
||||
private:
|
||||
nsTArray<nsRefPtr<PerformanceEntry>> mUserEntries;
|
||||
nsTArray<nsRefPtr<PerformanceEntry>> mResourceEntries;
|
||||
|
@ -64,6 +64,16 @@ Performance::GetPerformanceTimingFromString(const nsAString& aProperty)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
Performance::InsertUserEntry(PerformanceEntry* aEntry)
|
||||
{
|
||||
if (mWorkerPrivate->PerformanceLoggingEnabled()) {
|
||||
PerformanceBase::LogEntry(aEntry,
|
||||
NS_ConvertUTF16toUTF8(mWorkerPrivate->ScriptURL()));
|
||||
}
|
||||
PerformanceBase::InsertUserEntry(aEntry);
|
||||
}
|
||||
|
||||
DOMHighResTimeStamp
|
||||
Performance::DeltaFromNavigationStart(DOMHighResTimeStamp aTime)
|
||||
{
|
||||
|
@ -26,6 +26,8 @@ public:
|
||||
private:
|
||||
~Performance();
|
||||
|
||||
void InsertUserEntry(PerformanceEntry* aEntry) override;
|
||||
|
||||
WorkerPrivate* mWorkerPrivate;
|
||||
|
||||
public:
|
||||
|
@ -158,6 +158,7 @@ static_assert(MAX_WORKERS_PER_DOMAIN >= 1,
|
||||
|
||||
#define PREF_DOM_CACHES_ENABLED "dom.caches.enabled"
|
||||
#define PREF_DOM_CACHES_TESTING_ENABLED "dom.caches.testing.enabled"
|
||||
#define PREF_WORKERS_PERFORMANCE_LOGGING_ENABLED "dom.performance.enable_user_timing_logging"
|
||||
#define PREF_DOM_WORKERNOTIFICATION_ENABLED "dom.webnotifications.enabled"
|
||||
#define PREF_WORKERS_LATEST_JS_VERSION "dom.workers.latestJSVersion"
|
||||
#define PREF_INTL_ACCEPT_LANGUAGES "intl.accept_languages"
|
||||
@ -1940,6 +1941,10 @@ RuntimeService::Init()
|
||||
WorkerPrefChanged,
|
||||
PREF_DOM_CACHES_TESTING_ENABLED,
|
||||
reinterpret_cast<void *>(WORKERPREF_DOM_CACHES_TESTING))) ||
|
||||
NS_FAILED(Preferences::RegisterCallbackAndCall(
|
||||
WorkerPrefChanged,
|
||||
PREF_WORKERS_PERFORMANCE_LOGGING_ENABLED,
|
||||
reinterpret_cast<void *>(WORKERPREF_PERFORMANCE_LOGGING_ENABLED))) ||
|
||||
NS_FAILED(Preferences::RegisterCallbackAndCall(
|
||||
WorkerPrefChanged,
|
||||
PREF_SERVICEWORKERS_TESTING_ENABLED,
|
||||
@ -2147,6 +2152,10 @@ RuntimeService::Cleanup()
|
||||
WorkerPrefChanged,
|
||||
PREF_DOM_CACHES_TESTING_ENABLED,
|
||||
reinterpret_cast<void *>(WORKERPREF_DOM_CACHES_TESTING))) ||
|
||||
NS_FAILED(Preferences::UnregisterCallback(
|
||||
WorkerPrefChanged,
|
||||
PREF_WORKERS_PERFORMANCE_LOGGING_ENABLED,
|
||||
reinterpret_cast<void *>(WORKERPREF_PERFORMANCE_LOGGING_ENABLED))) ||
|
||||
NS_FAILED(Preferences::UnregisterCallback(
|
||||
WorkerPrefChanged,
|
||||
PREF_INTERCEPTION_OPAQUE_ENABLED,
|
||||
@ -2708,6 +2717,7 @@ RuntimeService::WorkerPrefChanged(const char* aPrefName, void* aClosure)
|
||||
case WORKERPREF_DOM_CACHES:
|
||||
case WORKERPREF_DOM_CACHES_TESTING:
|
||||
case WORKERPREF_DOM_WORKERNOTIFICATION:
|
||||
case WORKERPREF_PERFORMANCE_LOGGING_ENABLED:
|
||||
#ifdef DUMP_CONTROLLED_BY_PREF
|
||||
case WORKERPREF_DUMP:
|
||||
#endif
|
||||
|
@ -1321,6 +1321,13 @@ public:
|
||||
return mPreferences[WORKERPREF_DOM_CACHES_TESTING];
|
||||
}
|
||||
|
||||
bool
|
||||
PerformanceLoggingEnabled() const
|
||||
{
|
||||
AssertIsOnWorkerThread();
|
||||
return mPreferences[WORKERPREF_PERFORMANCE_LOGGING_ENABLED];
|
||||
}
|
||||
|
||||
bool
|
||||
OnLine() const
|
||||
{
|
||||
|
@ -205,6 +205,7 @@ enum WorkerPreference
|
||||
WORKERPREF_DOM_CACHES_TESTING, // dom.caches.testing.enabled
|
||||
WORKERPREF_SERVICEWORKERS_TESTING, // dom.serviceWorkers.testing.enabled
|
||||
WORKERPREF_INTERCEPTION_OPAQUE_ENABLED, // dom.serviceWorkers.interception.opaque.enabled
|
||||
WORKERPREF_PERFORMANCE_LOGGING_ENABLED, // dom.performance.enable_user_timing_logging
|
||||
WORKERPREF_COUNT
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user