Bug 1803810 - Part 3: Add methods to copy and move imported modules. r=jonco
In non-shared global, the sync load is performed by separate SyncModuleLoader,
with the following algorithm:
1. copy all loaded modules from async module loader, so that they can be
used in the module graph in SyncModuleLoader
2. import a module graph
3. move all modules to async module loader
ModuleLoaderBase::CopyModulesTo is for step 1, and
ModuleLoaderBase::MoveModulesTo is for step 3.
The consumer should assert that there's no fetching modules.
Differential Revision: https://phabricator.services.mozilla.com/D199455
This commit is contained in:
@@ -351,6 +351,21 @@ class ModuleLoaderBase : public nsISupports {
|
||||
|
||||
void ResetOverride();
|
||||
|
||||
// Copy fetched modules to `aDest`.
|
||||
// `this` shouldn't have any fetching.
|
||||
// `aDest` shouldn't have any fetching or fetched modules.
|
||||
//
|
||||
// This is used when starting sync module load, to replicate the module cache
|
||||
// in the sync module loader pointed by `aDest`.
|
||||
void CopyModulesTo(ModuleLoaderBase* aDest);
|
||||
|
||||
// Move all fetched modules to `aDest`.
|
||||
// Both `this` and `aDest` shouldn't have any fetching.
|
||||
//
|
||||
// This is used when finishing sync module load, to reflect the loaded modules
|
||||
// to the async module loader pointed by `aDest`.
|
||||
void MoveModulesTo(ModuleLoaderBase* aDest);
|
||||
|
||||
// Internal methods.
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user