Bug 1419771 - Introduce DOMPreferences, a thread-safe access to preferences for DOM - part 5 - Performance logging enabled, r=asuth
This commit is contained in:
@@ -38,6 +38,7 @@ DOMPreferences::DumpEnabled()
|
|||||||
PREF(ImageBitmapExtensionsEnabled, "canvas.imagebitmap_extensions.enabled")
|
PREF(ImageBitmapExtensionsEnabled, "canvas.imagebitmap_extensions.enabled")
|
||||||
PREF(DOMCachesEnabled, "dom.caches.enabled")
|
PREF(DOMCachesEnabled, "dom.caches.enabled")
|
||||||
PREF(DOMCachesTestingEnabled, "dom.caches.testing.enabled")
|
PREF(DOMCachesTestingEnabled, "dom.caches.testing.enabled")
|
||||||
|
PREF(PerformanceLoggingEnabled, "dom.performance.enable_user_timing_logging")
|
||||||
|
|
||||||
#undef PREF
|
#undef PREF
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ public:
|
|||||||
|
|
||||||
// Returns true if the dom.caches.testing.enabled pref is set.
|
// Returns true if the dom.caches.testing.enabled pref is set.
|
||||||
static bool DOMCachesTestingEnabled();
|
static bool DOMCachesTestingEnabled();
|
||||||
|
|
||||||
|
// Returns true if the dom.performance.enable_user_timing_logging pref is set.
|
||||||
|
static bool PerformanceLoggingEnabled();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // dom namespace
|
} // dom namespace
|
||||||
|
|||||||
@@ -294,7 +294,6 @@ bool nsContentUtils::sIsFrameTimingPrefEnabled = false;
|
|||||||
bool nsContentUtils::sIsPerformanceTimingEnabled = false;
|
bool nsContentUtils::sIsPerformanceTimingEnabled = false;
|
||||||
bool nsContentUtils::sIsResourceTimingEnabled = false;
|
bool nsContentUtils::sIsResourceTimingEnabled = false;
|
||||||
bool nsContentUtils::sIsPerformanceNavigationTimingEnabled = false;
|
bool nsContentUtils::sIsPerformanceNavigationTimingEnabled = false;
|
||||||
bool nsContentUtils::sIsUserTimingLoggingEnabled = false;
|
|
||||||
bool nsContentUtils::sIsFormAutofillAutocompleteEnabled = false;
|
bool nsContentUtils::sIsFormAutofillAutocompleteEnabled = false;
|
||||||
bool nsContentUtils::sIsWebComponentsEnabled = false;
|
bool nsContentUtils::sIsWebComponentsEnabled = false;
|
||||||
bool nsContentUtils::sIsCustomElementsEnabled = false;
|
bool nsContentUtils::sIsCustomElementsEnabled = false;
|
||||||
@@ -653,9 +652,6 @@ nsContentUtils::Init()
|
|||||||
Preferences::AddBoolVarCache(&sIsPerformanceNavigationTimingEnabled,
|
Preferences::AddBoolVarCache(&sIsPerformanceNavigationTimingEnabled,
|
||||||
"dom.enable_performance_navigation_timing", true);
|
"dom.enable_performance_navigation_timing", true);
|
||||||
|
|
||||||
Preferences::AddBoolVarCache(&sIsUserTimingLoggingEnabled,
|
|
||||||
"dom.performance.enable_user_timing_logging", false);
|
|
||||||
|
|
||||||
Preferences::AddBoolVarCache(&sIsFrameTimingPrefEnabled,
|
Preferences::AddBoolVarCache(&sIsFrameTimingPrefEnabled,
|
||||||
"dom.enable_frame_timing", false);
|
"dom.enable_frame_timing", false);
|
||||||
|
|
||||||
|
|||||||
@@ -2276,14 +2276,6 @@ public:
|
|||||||
return sIsPerformanceTimingEnabled;
|
return sIsPerformanceTimingEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns true if user timing API should print to console.
|
|
||||||
*/
|
|
||||||
static bool IsUserTimingLoggingEnabled()
|
|
||||||
{
|
|
||||||
return sIsUserTimingLoggingEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns true if the performance timing APIs are enabled.
|
* Returns true if the performance timing APIs are enabled.
|
||||||
*/
|
*/
|
||||||
@@ -3413,7 +3405,6 @@ private:
|
|||||||
static bool sIsPerformanceTimingEnabled;
|
static bool sIsPerformanceTimingEnabled;
|
||||||
static bool sIsResourceTimingEnabled;
|
static bool sIsResourceTimingEnabled;
|
||||||
static bool sIsPerformanceNavigationTimingEnabled;
|
static bool sIsPerformanceNavigationTimingEnabled;
|
||||||
static bool sIsUserTimingLoggingEnabled;
|
|
||||||
static bool sIsFrameTimingPrefEnabled;
|
static bool sIsFrameTimingPrefEnabled;
|
||||||
static bool sIsFormAutofillAutocompleteEnabled;
|
static bool sIsFormAutofillAutocompleteEnabled;
|
||||||
static bool sIsWebComponentsEnabled;
|
static bool sIsWebComponentsEnabled;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "PerformanceMainThread.h"
|
#include "PerformanceMainThread.h"
|
||||||
#include "PerformanceNavigation.h"
|
#include "PerformanceNavigation.h"
|
||||||
|
#include "mozilla/dom/DOMPreferences.h"
|
||||||
#include "nsICacheInfoChannel.h"
|
#include "nsICacheInfoChannel.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
@@ -271,7 +272,7 @@ PerformanceMainThread::InsertUserEntry(PerformanceEntry* aEntry)
|
|||||||
nsAutoCString uri;
|
nsAutoCString uri;
|
||||||
uint64_t markCreationEpoch = 0;
|
uint64_t markCreationEpoch = 0;
|
||||||
|
|
||||||
if (nsContentUtils::IsUserTimingLoggingEnabled() ||
|
if (DOMPreferences::PerformanceLoggingEnabled() ||
|
||||||
nsContentUtils::SendPerformanceTimingNotifications()) {
|
nsContentUtils::SendPerformanceTimingNotifications()) {
|
||||||
nsresult rv = NS_ERROR_FAILURE;
|
nsresult rv = NS_ERROR_FAILURE;
|
||||||
nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner();
|
nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner();
|
||||||
@@ -285,7 +286,7 @@ PerformanceMainThread::InsertUserEntry(PerformanceEntry* aEntry)
|
|||||||
}
|
}
|
||||||
markCreationEpoch = static_cast<uint64_t>(PR_Now() / PR_USEC_PER_MSEC);
|
markCreationEpoch = static_cast<uint64_t>(PR_Now() / PR_USEC_PER_MSEC);
|
||||||
|
|
||||||
if (nsContentUtils::IsUserTimingLoggingEnabled()) {
|
if (DOMPreferences::PerformanceLoggingEnabled()) {
|
||||||
Performance::LogEntry(aEntry, uri);
|
Performance::LogEntry(aEntry, uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "PerformanceWorker.h"
|
#include "PerformanceWorker.h"
|
||||||
|
#include "mozilla/dom/DOMPreferences.h"
|
||||||
#include "WorkerPrivate.h"
|
#include "WorkerPrivate.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
@@ -26,7 +27,7 @@ PerformanceWorker::~PerformanceWorker()
|
|||||||
void
|
void
|
||||||
PerformanceWorker::InsertUserEntry(PerformanceEntry* aEntry)
|
PerformanceWorker::InsertUserEntry(PerformanceEntry* aEntry)
|
||||||
{
|
{
|
||||||
if (mWorkerPrivate->PerformanceLoggingEnabled()) {
|
if (DOMPreferences::PerformanceLoggingEnabled()) {
|
||||||
nsAutoCString uri;
|
nsAutoCString uri;
|
||||||
nsCOMPtr<nsIURI> scriptURI = mWorkerPrivate->GetResolvedScriptURI();
|
nsCOMPtr<nsIURI> scriptURI = mWorkerPrivate->GetResolvedScriptURI();
|
||||||
if (!scriptURI || NS_FAILED(scriptURI->GetHost(uri))) {
|
if (!scriptURI || NS_FAILED(scriptURI->GetHost(uri))) {
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
// * First argument is the name of the pref.
|
// * First argument is the name of the pref.
|
||||||
// * The name of the function that updates the new value of a pref.
|
// * The name of the function that updates the new value of a pref.
|
||||||
|
|
||||||
WORKER_SIMPLE_PREF("dom.performance.enable_user_timing_logging", PerformanceLoggingEnabled, PERFORMANCE_LOGGING_ENABLED)
|
|
||||||
WORKER_SIMPLE_PREF("dom.webnotifications.enabled", DOMWorkerNotificationEnabled, DOM_WORKERNOTIFICATION)
|
WORKER_SIMPLE_PREF("dom.webnotifications.enabled", DOMWorkerNotificationEnabled, DOM_WORKERNOTIFICATION)
|
||||||
WORKER_SIMPLE_PREF("dom.webnotifications.serviceworker.enabled", DOMServiceWorkerNotificationEnabled, DOM_SERVICEWORKERNOTIFICATION)
|
WORKER_SIMPLE_PREF("dom.webnotifications.serviceworker.enabled", DOMServiceWorkerNotificationEnabled, DOM_SERVICEWORKERNOTIFICATION)
|
||||||
WORKER_SIMPLE_PREF("dom.webnotifications.requireinteraction.enabled", DOMWorkerNotificationRIEnabled, DOM_WORKERNOTIFICATIONRI)
|
WORKER_SIMPLE_PREF("dom.webnotifications.requireinteraction.enabled", DOMWorkerNotificationRIEnabled, DOM_WORKERNOTIFICATIONRI)
|
||||||
|
|||||||
Reference in New Issue
Block a user