Sunday, October 7, 2012

Code splitting not work as expected ?..

Code splitting don't seem to work in my case, please some advice.
All seem to be loaded in the initial download, and I am trying to figure out why, which seem to be difficult.

The soyc overal report:
---
Full code size: 1,128,912 Bytes
Initial download size: 1,127,984 Bytes
Left over code: 413 Bytes
----

For example: I have a controller called MemberLoonControllerDefault that should be loaded in a code split.
Looking at the soyc report, it says it's loaded in the initial download, a snippet:
---
com.bv.gwt.fresh.declare.inkomen.loon.impl.MemberLoonControllerDefault
Some code is included in the initial fragment ( See why)
---

First: when I click on the "see why" it goes to a none existing page, something like:
---
.../compile-report/methodDependencies-initial-B924E6D66110AAF33EFDD758D02DDDB9-0.html#com.bv.gwt.fresh.declare.inkomen.loon.impl.MemberLoonControllerDefault
---

I suppose I have to remove the MD5 code, such that it becomes something like this, which works:
---
../compile-report/methodDependencies-initial-0.html#com.bv.gwt.fresh.declare.inkomen.loon.impl.MemberLoonControllerDefault
---

The dependency path snippet: 
---
..loon.impl.LoonControllerBase::LoonControllerBase
..loon.impl.MemberLoonControllerDefault::MemberLoonControllerDefault
..loon.impl.LoonControllerBuilder$MemberLoonControllerBuilder::create
..loon.impl.LoonState$ShowMemberLoonRequest::perform
....
..EntryPointBase::$doStartApplication
...start.EntryPointBase$1::execute
..EntryPointBase::$onModuleLoad
---

LoonControllerBase is the parent class of the MemberLoonControllerDefault. 
The last part in the Builder is the interesting part:
----
MemberLoonControllerBuilder(final ControllerLoaderFacade controllerLoader, final SimpleAsyncCallback<MemberLoonController> callback,
final int declarationYear) {
super(controllerLoader, callback, declarationYear);
}

public void create(final AsyncCallback<Void> callback) {
getLazyLoader().createInCodeSplitDeclareMember1(callback);
}

public MemberLoonController create() {
return LoonFacade.getInstance().createMemberController(getMediator());
}
----

And the lazy loader (an interface) that is called in the create method, performs the actual creation of the controller in a split point:
---
public void createInCodeSplitDeclareMember1(final AsyncCallback<Void> callback) {
GWT.runAsync(new RunAsyncCallback() {
public void onSuccess() {
callback.onSuccess(null);
}

public void onFailure(final Throwable ex) {
callback.onFailure(ex);
}
});
}
----

When the callback.onSuccess() is called, it will call the above create() method in the Builder.
As you can see, the controller is created through a split point, which also clearly shows up in my IDE when following the Call hierarchy path.. Still gwt is putting the creation in the initial download which I don't understand.

Any idea ?
Might it has something to do with issue 4412? As I the controller is implementing general interfaces that are contained in the initial download....

Any advice, please ?
- Ed

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/MUqc7s4Sg8IJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment