What steps will reproduce the problem?
1. Run MainFrame.java from latest revision40 on Mac in osr and non-osr mode
with some instrumentation logging Java callbacks
2. Filter out the methods that are invoked multiple times from multiple threads
3.
What version of the product are you using? On what operating system?
Latest r40 on Mac, osr and non-osr.
Please provide any additional information below.
Here are some of the JCEF methods that are invoked from multiple threads
1) Mac jcef r40 non-osr jdk1.7
– Methods called from multiple threads –
org.cef.CefClientHandler:setNativeRef
AWT-AppKit
AWT-EventQueue-0
main
org.cef.CefBrowser_N:wasResized
AWT-EventQueue-0
main
org.cef.CefBrowser_N:getNativeRef
AWT-AppKit
AWT-EventQueue-0
main
org.cef.CefClientHandler:getNativeRef
AWT-AppKit
AWT-EventQueue-0
main
org.cef.CefClient:getLifeSpanHandler
AWT-AppKit
AWT-EventQueue-0
2) Mac jcef r40 osr jdk1.7
– Methods called from multiple threads –
org.cef.CefClientHandler:setNativeRef
AWT-AppKit
AWT-EventQueue-0
main
org.cef.CefClient:getRenderHandler
AWT-AppKit
AWT-EventQueue-0
org.cef.CefBrowser_N:getNativeRef
AWT-AppKit
AWT-EventQueue-0
org.cef.CefClientHandler:getNativeRef
AWT-AppKit
AWT-EventQueue-0
main
org.cef.CefClient:getLifeSpanHandler
AWT-AppKit
AWT-EventQueue-0
I did this thread analysis while looking for
https://code.google.com/p/javachromiumembedded/issues/detail?id=41
You might want to guard the use of N_CefHandle which is accessed from various
threads through getNativeRef / setNativeRef. Here's a trivial patch. Note this
did not address issue 41...
Here's a proposed patch.
public abstract class CefClientHandler implements CefNative {
// Used internally to store a pointer to the CEF object.
private HashMap<String,Long> N_CefHandle = new HashMap<String, Long>();
@Override
public void setNativeRef(String identifer, long nativeRef) {
++ synchronized(N_CefHandle) {
N_CefHandle.put(identifer, nativeRef);
++ }
}
@Override
public long getNativeRef(String identifer) {
++ synchronized(N_CefHandle) {
if (N_CefHandle.containsKey(identifer))
return N_CefHandle.get(identifer);
++ }
return 0;
}
Original issue reported on code.google.com by christop...@gmail.com on 16 Apr 2014 at 8:33
Original issue reported on code.google.com by
christop...@gmail.com
on 16 Apr 2014 at 8:33