mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1659885 - Define |JS::shadow::Realm| in public shadow API in its own minimal header. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D87536
This commit is contained in:
parent
47fa4336f7
commit
2fe4e38ce2
@ -7,6 +7,8 @@
|
||||
#ifndef js_Realm_h
|
||||
#define js_Realm_h
|
||||
|
||||
#include "js/shadow/Realm.h" // JS::shadow::Realm
|
||||
|
||||
#include "jspubtd.h"
|
||||
#include "js/GCAPI.h"
|
||||
#include "js/GCPolicyAPI.h"
|
||||
@ -39,23 +41,6 @@ struct GCPolicy<Realm*> : public NonGCPointerPolicy<Realm*> {
|
||||
// Realm Record".
|
||||
extern JS_PUBLIC_API Realm* GetCurrentRealmOrNull(JSContext* cx);
|
||||
|
||||
namespace shadow {
|
||||
|
||||
class Realm {
|
||||
protected:
|
||||
JS::Compartment* compartment_;
|
||||
|
||||
explicit Realm(JS::Compartment* comp) : compartment_(comp) {}
|
||||
|
||||
public:
|
||||
JS::Compartment* compartment() { return compartment_; }
|
||||
static shadow::Realm* get(JS::Realm* realm) {
|
||||
return reinterpret_cast<shadow::Realm*>(realm);
|
||||
}
|
||||
};
|
||||
|
||||
}; // namespace shadow
|
||||
|
||||
// Return the compartment that contains a given realm.
|
||||
inline JS::Compartment* GetCompartmentForRealm(Realm* realm) {
|
||||
return shadow::Realm::get(realm)->compartment();
|
||||
|
38
js/public/shadow/Realm.h
Normal file
38
js/public/shadow/Realm.h
Normal file
@ -0,0 +1,38 @@
|
||||
/* -*- 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/. */
|
||||
|
||||
/* Shadow definition of |JS::Realm| innards. Do not use this directly! */
|
||||
|
||||
#ifndef js_shadow_Realm_h
|
||||
#define js_shadow_Realm_h
|
||||
|
||||
#include "jstypes.h" // JS_PUBLIC_API
|
||||
|
||||
namespace JS {
|
||||
|
||||
class JS_PUBLIC_API Compartment;
|
||||
class JS_PUBLIC_API Realm;
|
||||
|
||||
namespace shadow {
|
||||
|
||||
class Realm {
|
||||
protected:
|
||||
JS::Compartment* compartment_;
|
||||
|
||||
explicit Realm(JS::Compartment* comp) : compartment_(comp) {}
|
||||
|
||||
public:
|
||||
JS::Compartment* compartment() { return compartment_; }
|
||||
static shadow::Realm* get(JS::Realm* realm) {
|
||||
return reinterpret_cast<shadow::Realm*>(realm);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace shadow
|
||||
|
||||
} // namespace JS
|
||||
|
||||
#endif // js_shadow_Realm_h
|
@ -30,6 +30,7 @@ typedef uint32_t HashNumber;
|
||||
#include "js/PropertySpec.h"
|
||||
#include "js/shadow/Object.h"
|
||||
#include "js/shadow/ObjectGroup.h"
|
||||
#include "js/shadow/Realm.h"
|
||||
#include "js/shadow/Zone.h"
|
||||
#include "js/SourceText.h"
|
||||
#include "js/StructuredClone.h"
|
||||
|
@ -257,6 +257,7 @@ EXPORTS.js.shadow += [
|
||||
'../public/shadow/Function.h',
|
||||
'../public/shadow/Object.h',
|
||||
'../public/shadow/ObjectGroup.h',
|
||||
'../public/shadow/Realm.h',
|
||||
'../public/shadow/Shape.h',
|
||||
'../public/shadow/String.h',
|
||||
'../public/shadow/Symbol.h',
|
||||
|
@ -4,6 +4,7 @@
|
||||
* 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/. */
|
||||
|
||||
#include "js/shadow/Realm.h" // JS::shadow::Realm
|
||||
#include "vm/Realm-inl.h"
|
||||
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
|
Loading…
Reference in New Issue
Block a user