Code splitting not work as expected ?..

37 views
Skip to first unread message

Ed

unread,
Oct 7, 2012, 9:47:35 AM10/7/12
to google-we...@googlegroups.com
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

Reply all
Reply to author
Forward
0 new messages