diff options
author | Sven Gothel <[email protected]> | 2010-04-28 07:35:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-04-28 07:35:36 +0200 |
commit | 3dfb97a57bf1116c44709c50cbb9d0628967fd52 (patch) | |
tree | c12e70d6d14c22ed70f48b8877fc7514139c91ba /src | |
parent | 9346e4f91dc468730efac8ad6f1d9d8024e8e93b (diff) |
GLProfile static init within privileged block
Diffstat (limited to 'src')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLProfile.java | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index cbf50a94d..7b8ac6c2a 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -43,8 +43,7 @@ import com.jogamp.opengl.impl.GLJNILibLoader; import com.jogamp.common.jvm.JVMUtil; import java.util.HashMap; import java.util.Iterator; -import java.security.AccessControlContext; -import java.security.AccessController; +import java.security.*; import javax.media.opengl.fixedfunc.GLPointerFunc; /** @@ -780,8 +779,8 @@ public class GLProfile implements Cloneable { // This is here only to avoid having separate GL2ES1Impl and GL2ES2Impl classes private static final String GL2ES12 = "GL2ES12"; - private static final boolean isAWTAvailable; - private static final boolean isAWTJOGLAvailable; + private static /*final*/ boolean isAWTAvailable; + private static /*final*/ boolean isAWTJOGLAvailable; private static /*final*/ boolean hasGL234Impl; private static /*final*/ boolean hasGL4bcImpl; @@ -804,6 +803,11 @@ public class GLProfile implements Cloneable { * Throws an GLException if no profile could be found at all. */ static { + // run the whole static initialization privileged to speed up, + // since this skips checking further access + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + JVMUtil.initSingleton(); AccessControlContext acc = AccessController.getContext(); @@ -983,9 +987,6 @@ public class GLProfile implements Cloneable { } mappedProfiles = computeProfileMap(); - if(null==defaultGLProfile) { - throw new GLException("No profile available: "+list2String(GL_PROFILE_LIST_ALL)+", "+glAvailabilityToString()); - } if (DEBUG) { System.err.println("GLProfile.static isAWTAvailable "+isAWTAvailable); @@ -998,6 +999,14 @@ public class GLProfile implements Cloneable { System.err.println("GLProfile.static hasGL234Impl "+hasGL234Impl); System.err.println("GLProfile.static "+glAvailabilityToString()); } + + return null; + } + }); + + if(null==defaultGLProfile) { + throw new GLException("No profile available: "+list2String(GL_PROFILE_LIST_ALL)+", "+glAvailabilityToString()); + } } private static final String list2String(String[] list) { |