1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:37:36 +00:00

LibWeb: Make wrapper factory functions take JS::GlobalObject&

Instead of taking the JS::Heap&. This allows us to get rid of some
calls to JS::Interpreter::global_object(). We're getting closer and
closer to multiple global objects. :^)
This commit is contained in:
Andreas Kling 2020-06-23 16:57:39 +02:00
parent c24f5585b2
commit fc4ed8d444
12 changed files with 33 additions and 36 deletions

View file

@ -28,7 +28,7 @@
#include <AK/WeakPtr.h>
#include <LibJS/Heap/Heap.h>
#include <LibJS/Interpreter.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibWeb/Forward.h>
namespace Web {
@ -47,11 +47,10 @@ private:
};
template<class NativeObject>
inline Wrapper* wrap_impl(JS::Heap& heap, NativeObject& native_object)
inline Wrapper* wrap_impl(JS::GlobalObject& global_object, NativeObject& native_object)
{
if (!native_object.wrapper()) {
auto& global_object = heap.interpreter().global_object();
native_object.set_wrapper(*heap.allocate<typename NativeObject::WrapperType>(global_object, global_object, native_object));
native_object.set_wrapper(*global_object.heap().allocate<typename NativeObject::WrapperType>(global_object, global_object, native_object));
}
return native_object.wrapper();
}