Bug 1492011 change CreateCounterOrResetCounterValue from instance method to nonmember function with internal linkage r=baku

Depends on D67995

Differential Revision: https://phabricator.services.mozilla.com/D67996

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Karl Tomlinson 2020-03-24 09:55:53 +00:00
Родитель 74303d90fd
Коммит 42e23b8bed
2 изменённых файлов: 14 добавлений и 13 удалений

Просмотреть файл

@ -87,6 +87,10 @@ static bool ProcessArguments(JSContext* aCx, const Sequence<JS::Value>& aData,
Sequence<JS::Value>& aSequence, Sequence<JS::Value>& aSequence,
Sequence<nsString>& aStyles); Sequence<nsString>& aStyles);
static JS::Value CreateCounterOrResetCounterValue(JSContext* aCx,
const nsAString& aCountLabel,
uint32_t aCountValue);
/** /**
* Console API in workers uses the Structured Clone Algorithm to move any value * Console API in workers uses the Structured Clone Algorithm to move any value
* from the worker thread to the main-thread. Some object cannot be moved and, * from the worker thread to the main-thread. Some object cannot be moved and,
@ -2296,8 +2300,16 @@ uint32_t Console::ResetCounter(JSContext* aCx,
return MAX_PAGE_COUNTERS; return MAX_PAGE_COUNTERS;
} }
JS::Value Console::CreateCounterOrResetCounterValue( // This method generates a ConsoleCounter dictionary as JS::Value. If
JSContext* aCx, const nsAString& aCountLabel, uint32_t aCountValue) const { // aCountValue is == MAX_PAGE_COUNTERS it generates a ConsoleCounterError
// instead. See IncreaseCounter.
// * aCx - this is the context that will root the returned value.
// * aCountLabel - this label must be what IncreaseCounter received as
// aTimerLabel.
// * aCountValue - the return value of IncreaseCounter.
static JS::Value CreateCounterOrResetCounterValue(JSContext* aCx,
const nsAString& aCountLabel,
uint32_t aCountValue) {
ConsoleCommon::ClearException ce(aCx); ConsoleCommon::ClearException ce(aCx);
if (aCountValue == MAX_PAGE_COUNTERS) { if (aCountValue == MAX_PAGE_COUNTERS) {

Просмотреть файл

@ -346,17 +346,6 @@ class Console final : public nsIObserver, public nsSupportsWeakReference {
uint32_t ResetCounter(JSContext* aCx, const Sequence<JS::Value>& aData, uint32_t ResetCounter(JSContext* aCx, const Sequence<JS::Value>& aData,
nsAString& aCountLabel); nsAString& aCountLabel);
// This method generates a ConsoleCounter dictionary as JS::Value. If
// aCountValue is == MAX_PAGE_COUNTERS it generates a ConsoleCounterError
// instead. See IncreaseCounter.
// * aCx - this is the context that will root the returned value.
// * aCountLabel - this label must be what IncreaseCounter received as
// aTimerLabel.
// * aCountValue - the return value of IncreaseCounter.
JS::Value CreateCounterOrResetCounterValue(JSContext* aCx,
const nsAString& aCountLabel,
uint32_t aCountValue) const;
static bool ShouldIncludeStackTrace(MethodName aMethodName); static bool ShouldIncludeStackTrace(MethodName aMethodName);
JSObject* GetOrCreateSandbox(JSContext* aCx, nsIPrincipal* aPrincipal); JSObject* GetOrCreateSandbox(JSContext* aCx, nsIPrincipal* aPrincipal);