public class AsyncFragmentLoader extends Object
Low-level support to download an extra fragment of code. This should not be invoked directly by user code.
The fragments are numbered as follows, assuming there are m split points:
Since the precise way to load code depends on the linker, linkers should
specify a rebind of AsyncFragmentLoader.LoadingStrategy
.
Modifier and Type | Class and Description |
---|---|
static interface |
AsyncFragmentLoader.LoadingStrategy
A strategy for loading code fragments.
|
static interface |
AsyncFragmentLoader.LoadTerminatedHandler
An interface for handlers of load completion.
|
static interface |
AsyncFragmentLoader.Logger
A strategy for logging progress.
|
static class |
AsyncFragmentLoader.LwmLabels
Labels used for runAsync lightweight metrics.
|
static class |
AsyncFragmentLoader.StandardLogger
The standard logger used in a web browser.
|
Modifier and Type | Field and Description |
---|---|
static AsyncFragmentLoader |
BROWSER_LOADER
The standard instance of AsyncFragmentLoader used in a web browser.
|
Constructor and Description |
---|
AsyncFragmentLoader(int numEntries,
int[] initialLoadSequence,
AsyncFragmentLoader.LoadingStrategy loadingStrategy,
AsyncFragmentLoader.Logger logger,
com.google.gwt.core.client.impl.OnSuccessExecutor executor) |
Modifier and Type | Method and Description |
---|---|
boolean |
isAlreadyLoaded(int splitPoint) |
static void |
onLoad(int fragment)
Called by compiler-generated code when a fragment is loaded.
|
static void |
runAsync(int fragment,
RunAsyncCallback callback)
Called by the compiler to implement
GWT.runAsync(java.lang.Class<?>, com.google.gwt.core.client.RunAsyncCallback) . |
void |
setPrefetchQueue(int... runAsyncSplitPoints)
Request that a sequence of split points be prefetched.
|
void |
startPrefetching() |
void |
stopPrefetching() |
public static AsyncFragmentLoader BROWSER_LOADER
null
. When compiled to
JavaScript, the parameters to this call are rewritten by
ReplaceRunAsyncs
. So this must be a
method call of exactly two arguments to succeed when invoked in web mode.public AsyncFragmentLoader(int numEntries, int[] initialLoadSequence, AsyncFragmentLoader.LoadingStrategy loadingStrategy, AsyncFragmentLoader.Logger logger, com.google.gwt.core.client.impl.OnSuccessExecutor executor)
public static void onLoad(int fragment)
fragment
- the fragment numberpublic static void runAsync(int fragment, RunAsyncCallback callback)
GWT.runAsync(java.lang.Class<?>, com.google.gwt.core.client.RunAsyncCallback)
.fragment
- the fragment numbercallback
- the callback to runpublic boolean isAlreadyLoaded(int splitPoint)
public void setPrefetchQueue(int... runAsyncSplitPoints)
splitPoints
will be downloaded and installed
whenever there is nothing else to download. Each call to this method
overwrites the entire prefetch queue with the newly specified one.public void startPrefetching()
public void stopPrefetching()
Copyright © 2018. All rights reserved.