DescriptionIssue #4692 - Rewrite `SetTimeout` facility to avoid `JsValuePtr` and `JsValueList`
Rewrite the implementation of `SetTimeout` to use new classes that avoid the
use of classes with embedded shared pointers to the engine. The focus of this
is the class `TimeoutTask`. Redeclare its member `function` from `JsValuePtr`
to a v8 Persistent. Redeclare its member `functionArguments from `JsValueList`
to an allocated array of v8 Persistent. Rework its constructor, factory
function, and `operator()` method to accomodate these changes. Move most of
the code from the `TimeoutTask` constructor to `CallbackForSetTimeout`, which
intrinsically acts as its factory method.
Add "JsEngineInternal.h" to hold engine interfaces that do not belong in the
public API. Add class `JsEngineInternal`, derived from `JsEngine`, to be the
new instantiation class. Move `context` out of the external class as allocated
member into the internal class as an ordinary member. Rework the engine
factory and constructors, doing more in the constructors and documenting
better the code necessarily inside the factory.
Add class `V8PersistentNG`. This class mimics the interface and behavior of
v8::Persistent in versions of v8 more recent than our current one.
Add class `AllocatedArray`. This utility class wraps a heap-allocated array in
a `unique_ptr` for automatic memory management. Add class
`PersistentValueArray` to hold v8 argument lists that must persist across
thread invocations. It has a utility method `GetAsLocal` to convert its
persistent handles into the local ones needed for function invocation.
Add `MakeCallback()`, `ExtractEngine()`, `ApplyFunction()` (all on the
internal side) to replace `NewCallback`. `FromArguments`, and `CallFunction`.
The replacements do not hold shared pointers anywhere, as well as being
cleaner and shorter. The legacy functions will remain until all their callers
have been rewritten.
Add class `V8ExecutionScope`, constructed with `JsEngineInternal*` (plain
pointer) rather with than `JsEnginePtr` (shared pointer). Rewrote `JsContext`
as a legacy wrapper around the new class.
Add `JsEngineInternal::GetGlobalObject()` to supersede the old one that uses
`JsValuePtr`. Clean up legacy global object handling a bit, needed for the
rewrite of `JsContext`.
Add file `JsEngineTransition.h` to hold declarations that are only expected
to be needed during the transition away from using shared pointer classes
within the implementations of engine tasks. Add `ToInternal()` to extract an
internal pointer out of `JsEnginePtr`.
Patch Set 1 : #
Total comments: 3
MessagesTotal messages: 1
|