summaryrefslogtreecommitdiffstats
path: root/client/src/main
diff options
context:
space:
mode:
authorLeif Åstrand <legioth@gmail.com>2017-06-21 11:02:46 +0300
committerHenri Sara <henri.sara@gmail.com>2017-06-21 11:02:46 +0300
commit87be139332c51fbae0dd3ff462556d8fd0c566ab (patch)
treef006ec4024d2528fcdc36049c58d39ef51908b01 /client/src/main
parent41d19a79a113de9d3d1624c4bb2fa3237a37dcf0 (diff)
downloadvaadin-framework-87be139332c51fbae0dd3ff462556d8fd0c566ab.tar.gz
vaadin-framework-87be139332c51fbae0dd3ff462556d8fd0c566ab.zip
Load the debug window implementation asynchronously (#9026)
Reduces the gzipped DefaultWidgetset eager bundle size from 345kb to 325kb. The relative impact is greater optimized widgetsets that might have down to around 150kb in the eager bundle.
Diffstat (limited to 'client/src/main')
-rw-r--r--client/src/main/java/com/vaadin/client/ApplicationConfiguration.java108
1 files changed, 56 insertions, 52 deletions
diff --git a/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java b/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java
index 3065a8a097..4c2583e493 100644
--- a/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java
+++ b/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java
@@ -714,56 +714,6 @@ public class ApplicationConfiguration implements EntryPoint {
// Register pointer events (must be done before any events are used)
PointerEventSupport.init();
- // Prepare the debugging window
- if (isDebugMode()) {
- /*
- * XXX Lots of implementation details here right now. This should be
- * cleared up when an API for extending the debug window is
- * implemented.
- */
- VDebugWindow window = VDebugWindow.get();
-
- if (LogConfiguration.loggingIsEnabled()) {
- window.addSection((Section) GWT.create(LogSection.class));
- }
- window.addSection((Section) GWT.create(InfoSection.class));
- window.addSection((Section) GWT.create(HierarchySection.class));
- window.addSection((Section) GWT.create(NetworkSection.class));
- window.addSection((Section) GWT.create(TestBenchSection.class));
- if (Profiler.isEnabled()) {
- window.addSection((Section) GWT.create(ProfilerSection.class));
- }
-
- if (isQuietDebugMode()) {
- window.close();
- } else {
- // Load debug window styles asynchronously
- GWT.runAsync(new RunAsyncCallback() {
- @Override
- public void onSuccess() {
- DebugWindowStyles dws = GWT
- .create(DebugWindowStyles.class);
- dws.css().ensureInjected();
- }
-
- @Override
- public void onFailure(Throwable reason) {
- Window.alert(
- "Failed to load Vaadin debug window styles");
- }
- });
-
- window.init();
- }
-
- // Connect to the legacy API
- VConsole.setImplementation(window);
-
- Handler errorNotificationHandler = GWT
- .create(ErrorNotificationHandler.class);
- Logger.getLogger("").addHandler(errorNotificationHandler);
- }
-
if (LogConfiguration.loggingIsEnabled()) {
GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@@ -791,7 +741,62 @@ public class ApplicationConfiguration implements EntryPoint {
// page once done compiling
return;
}
- registerCallback(GWT.getModuleName());
+
+ if (isDebugMode()) {
+ // Load debug window bundle and continue the bootstrap sequence once
+ // it's loaded
+ GWT.runAsync(VDebugWindow.class, new RunAsyncCallback() {
+ @Override
+ public void onSuccess() {
+ initDebugWindow();
+ registerCallback(GWT.getModuleName());
+ }
+
+ @Override
+ public void onFailure(Throwable reason) {
+ Window.alert("Failed to load Vaadin debug window");
+ registerCallback(GWT.getModuleName());
+ }
+ });
+ } else {
+ // Continue the bootstrap sequence right away
+ registerCallback(GWT.getModuleName());
+ }
+ }
+
+ private static void initDebugWindow() {
+ /*
+ * XXX Lots of implementation details here right now. This should be
+ * cleared up when an API for extending the debug window is implemented.
+ */
+ VDebugWindow window = VDebugWindow.get();
+
+ if (LogConfiguration.loggingIsEnabled()) {
+ window.addSection((Section) GWT.create(LogSection.class));
+ }
+ window.addSection((Section) GWT.create(InfoSection.class));
+ window.addSection((Section) GWT.create(HierarchySection.class));
+ window.addSection((Section) GWT.create(NetworkSection.class));
+ window.addSection((Section) GWT.create(TestBenchSection.class));
+ if (Profiler.isEnabled()) {
+ window.addSection((Section) GWT.create(ProfilerSection.class));
+ }
+
+ if (isQuietDebugMode()) {
+ window.close();
+ } else {
+ DebugWindowStyles dws = GWT.create(DebugWindowStyles.class);
+ dws.css().ensureInjected();
+
+ window.init();
+ }
+
+ // Connect to the legacy API
+ VConsole.setImplementation(window);
+
+ Handler errorNotificationHandler = GWT
+ .create(ErrorNotificationHandler.class);
+ Logger.getLogger("").addHandler(errorNotificationHandler);
}
/**
@@ -907,5 +912,4 @@ public class ApplicationConfiguration implements EntryPoint {
private static final Logger getLogger() {
return Logger.getLogger(ApplicationConfiguration.class.getName());
}
-
}