Bug 1877541 - WebGL about:support prints per-context inProcess/outOfProcess bool status. r=gfx-reviewers,lsalzman

Differential Revision: https://phabricator.services.mozilla.com/D200065
This commit is contained in:
Kelsey Gilbert
2024-01-31 17:12:53 +00:00
parent 53baf08689
commit b940c8ac31
2 changed files with 21 additions and 4 deletions

View File

@@ -2405,12 +2405,15 @@ void ClientWebGLContext::GetParameter(JSContext* cx, GLenum pname,
if (asString) {
const auto maybe = GetString(pname);
if (maybe) {
auto str = *maybe;
auto str = std::string{};
if (pname == dom::MOZ_debug_Binding::WSI_INFO) {
nsPrintfCString more("\nIsWebglOutOfProcessEnabled: %i",
int(IsWebglOutOfProcessEnabled()));
str += more.BeginReading();
const auto& outOfProcess = mNotLost->outOfProcess;
const auto& inProcess = mNotLost->inProcess;
str += PrintfStdString("outOfProcess: %s\ninProcess: %s\n",
ToChars(bool(outOfProcess)),
ToChars(bool(inProcess)));
}
str += *maybe;
retval.set(StringValue(cx, str.c_str(), rv));
}
} else {

View File

@@ -1273,6 +1273,20 @@ struct IndexedBufferBinding final {
uint64_t ByteCount() const;
};
// -
template <class... Args>
inline std::string PrintfStdString(const char* const format,
const Args&... args) {
const auto nsStr = nsPrintfCString(format, args...);
return ToString(nsStr);
}
inline const char* ToChars(const bool val) {
if (val) return "true";
return "false";
}
} // namespace mozilla
#endif