private void startLoadingFragment(int fragment) { assert (fragmentLoading < 0); fragmentLoading = fragment; logDownloadStart(fragment); loadingStrategy.startLoadingFragment(fragment, new ResetAfterDownloadFailure(fragment)); }
private static void cleanup(RequestData request) { boolean neverCalled = clearAsyncCallback(request.getFragment()); if (neverCalled) { request.onLoadError(new HttpDownloadFailure(request.getUrl(), 404, "Script Tag Failure - no status available"), true); } }
@Override public void scheduleIncremental(RepeatingCommand cmd) { // Push repeating commands onto the same initial queue for relative order deferredCommands = push(deferredCommands, Task.create(cmd)); maybeSchedulePostEventPumpCommands(); }
public void startLoadingFragment(int fragment, LoadTerminatedHandler loadFinishedHandler) { JavaScriptObject tag = createScriptTag(getUrl(fragment)); setOnSuccess(fragment, removeTagAndEvalCode(fragment, tag)); setOnFailure(tag, removeTagAndCallErrorHandler(fragment, tag, loadFinishedHandler)); installScriptTag(tag); }
private void maybeSchedulePostEventPumpCommands() { if (!shouldBeRunning) { shouldBeRunning = true; if (flusher == null) { flusher = new Flusher(); } scheduleFixedDelayImpl(flusher, FLUSHER_DELAY); if (rescue == null) { rescue = new Rescuer(); } scheduleFixedDelayImpl(rescue, RESCUE_DELAY); } }
/** * Initialize {@link #remainingInitialFragments} if it isn't already. */ private void initializeRemainingInitialFragments() { if (remainingInitialFragments == null) { remainingInitialFragments = new BoundedIntQueue(initialLoadSequence.length + 1); for (int sp : initialLoadSequence) { remainingInitialFragments.add(sp); } remainingInitialFragments.add(leftoversFragment()); } }
private static void asyncCallback(RequestData request, String code) { boolean firstTimeCalled = clearAsyncCallback(request.getFragment()); if (firstTimeCalled) { request.tryInstall(code); } }
public void tryInstall(String code) { try { gwtInstallCode(code); } catch (RuntimeException e) { String textIntro = code; if (textIntro != null && textIntro.length() > MAX_LOG_LENGTH) { textIntro = textIntro.substring(0, MAX_LOG_LENGTH) + "..."; } onLoadError(new HttpInstallFailure(url, textIntro, e), false); } } }
public static StackTraceElement[] constructJavaStackTrace(Throwable thrown) { StackTraceElement[] stackTrace = collector.getStackTrace(thrown); return dropInternalFrames(stackTrace); }
/** * Gets the name of the running module. */ public static String getModuleName() { return Impl.getModuleName(); }
/** * Gets the URL prefix of the hosting page, useful for prepending to relative * paths of resources which may be relative to the host page. Typically, you * should use {@link #getModuleBaseURL()} unless you have a specific reason to * load a resource relative to the host page. * * @return if non-empty, the base URL is guaranteed to end with a slash */ public static String getHostPageBaseURL() { return Impl.getHostPageBaseURL(); }
private boolean isInitial(int splitPoint) { if (splitPoint == leftoversFragment()) { return true; } for (int sp : initialLoadSequence) { if (sp == splitPoint) { return true; } } return false; }
@Override public void execute() { fragmentLoader.executeOnSuccess0(callback); } });
/** * Called by compiler-generated code when a fragment is loaded. * * @param fragment the fragment number */ public static void onLoad(int fragment) { BROWSER_LOADER.onLoadImpl(fragment); }
@Override public void scheduleDeferred(ScheduledCommand cmd) { deferredCommands = push(deferredCommands, Task.create(cmd)); maybeSchedulePostEventPumpCommands(); }