Open magreenblatt opened 1 year ago
Does this issue reproduce with the JCEF sample applications?
Original comment by Osiris Team (Bitbucket: Osiris Team).
Yeah. @{557058:2f2a2aee-b500-4023-9734-037e9897c3ab}
I used the MainFrame class (I guess that is what you meant by sample application) from here: https://bitbucket.org/chromiumembedded/java-cef/src/master/java/tests/simple/MainFrame.java
I had to change a few things because I am using the maven JCEF version by fvrii:
private MainFrame(String startURL, boolean useOSR, boolean isTransparent) throws UnsupportedPlatformException, CefInitializationException, IOException, InterruptedException {
CefAppBuilder builder = new CefAppBuilder();
builder.getCefSettings().windowless_rendering_enabled = useOSR;
builder.setAppHandler(new MavenCefAppHandlerAdapter() {
@Override
public void stateHasChanged(org.cef.CefApp.CefAppState state) {
// Shutdown the app if the native CEF part is terminated
if (state == CefApp.CefAppState.TERMINATED) System.exit(0);
}
});
cefApp_ = builder.build();
client_ = cefApp_.createClient();
client_.addLoadHandler(new CefLoadHandlerAdapter() {
@Override
public void onLoadingStateChange(CefBrowser browser, boolean isLoading, boolean canGoBack, boolean canGoForward) {
System.out.println("onLoadingStateChange "+ browser.getURL() + " "+ isLoading +" " +canGoBack +" "+ canGoForward);
}
});
...
The MainFrame class throws an exception btw, when ran in osr only with the changes above…
Unable to determine GraphicsConfiguration: WindowsWGLGraphicsConfiguration[DefaultGraphicsScreen[WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0xdfc92f]], idx 0], pfdID 20, ARB-Choosen true,
requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
chosen GLCaps[wgl vid 20 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]]
...
at java.desktop@16.0.2/java.awt.Window.pack(Window.java:825)
at app//com.osiris.desku.MainFrame.<init>(CefOffscreenTest.java:163)
...
So I had to fix that first by adding an if block:
if(!useOSR){
pack();
setSize(800, 600);
setVisible(true);
}
And there you go. No load event what so ever.
Looks like it depends on pack() or setVisible() being called, even in osr mode, which isn’t possible…
Also isLoaded() seems to always return true, which also may be caused by this.
Original comment by Osiris Team (Bitbucket: Osiris Team).
Another thing: You should also test osr mode in a headless environment, which can be simulated by setting java.awt.headless=true
because that is probably the environment where people are going to use osr.
So the code above also will throw a headless exception, because a JFrame is created (and if I remember correctly there was something in the CefBrowserOsr class that caused that exception too).
Original changes by Osiris Team (Bitbucket: Osiris Team).
Original changes by Osiris Team (Bitbucket: Osiris Team).
Original report by Osiris Team (Bitbucket: Osiris Team).
Lastest JCEF version.
To reproduce simply try creating a cef instance with windowless_rendering=true and a browser with offscreen-rendering=true.
You will notice that no load events are getting triggered, no matter what start-url is provided.