summaryrefslogtreecommitdiffstats
path: root/make/config/nativewindow/jawt-CustomJavaCode.java
blob: 16bce36e3b62558e29d7636a47479acb9a43841f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
private int jawt_version_cached = 0;

public final int getCachedVersion() {
    return jawt_version_cached;
}

protected static boolean getJAWT(final JAWT jawt, final int jawt_version_flags) {
    JAWTUtil.initSingleton();
    // Workaround for 4845371.
    // Make sure the first reference to the JNI GetDirectBufferAddress is done
    // from a privileged context so the VM's internal class lookups will succeed.
    return SecurityUtil.doPrivileged(new PrivilegedAction<Boolean>() {
        public Boolean run() {
          jawt.setVersion(jawt_version_flags);
          if (JAWTFactory.JAWT_GetAWT(jawt)) {
            jawt.jawt_version_cached = jawt.getVersion();
            return new Boolean(true);
          }
          jawt.jawt_version_cached = 0;
          return new Boolean(false);
        }
      }).booleanValue();
}