Bug 1711421 - Move SetPerformanceHint API to a new header file r=sfink

This API will eventually be removed, but for now give it its own header file.

Depends on D115189

Differential Revision: https://phabricator.services.mozilla.com/D115190
This commit is contained in:
Jon Coppeard 2021-05-17 15:36:35 +00:00
Родитель 6531658d49
Коммит 80b6c33b1c
3 изменённых файлов: 29 добавлений и 14 удалений

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

@ -0,0 +1,27 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: set ts=8 sts=2 et sw=2 tw=80:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef js_friend_PerformanceHint_h
#define js_friend_PerformanceHint_h
namespace js {
namespace gc {
// API to let the DOM tell us whether we're currently in pageload, so we can
// change the GC triggers to discourage collection of the atoms zone.
//
// This is a temporary measure until parsing is changed to not allocate GC
// things off the main thread.
enum class PerformanceHint { Normal, InPageLoad };
extern JS_FRIEND_API void SetPerformanceHint(JSContext* cx,
PerformanceHint hint);
} /* namespace gc */
} /* namespace js */
#endif // js_friend_PerformanceHint_h

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

@ -17,6 +17,7 @@
#include "js/Class.h"
#include "js/ErrorReport.h"
#include "js/Exception.h"
#include "js/friend/PerformanceHint.h"
#include "js/GCAPI.h"
#include "js/HeapAPI.h"
#include "js/Object.h" // JS::GetClass
@ -775,20 +776,6 @@ extern JS_FRIEND_API void RemapRemoteWindowProxies(
JSContext* cx, CompartmentTransplantCallback* callback,
JS::MutableHandleObject newTarget);
namespace gc {
// API to let the DOM tell us whether we're currently in pageload, so we can
// change the GC triggers to discourage collection of the atoms zone.
//
// This is a temporary measure; bug 1544117 will make this unnecessary.
enum class PerformanceHint { Normal, InPageLoad };
extern JS_FRIEND_API void SetPerformanceHint(JSContext* cx,
PerformanceHint hint);
} /* namespace gc */
extern JS_FRIEND_API JS::Zone* GetObjectZoneFromAnyThread(const JSObject* obj);
} /* namespace js */

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

@ -253,6 +253,7 @@ EXPORTS.js.friend += [
"../public/friend/ErrorMessages.h",
"../public/friend/ErrorNumbers.msg",
"../public/friend/JSMEnvironment.h",
"../public/friend/PerformanceHint.h",
"../public/friend/StackLimits.h",
"../public/friend/UsageStatistics.h",
"../public/friend/WindowProxy.h",