提交 c98980d5 编写于 作者: S serb

8192030: Better MTSchema support

Reviewed-by: skoivu, rhalade, prr, aghaisas
上级 06bdbf91
/*
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -61,6 +61,7 @@ public final class ThemeReader {
private static final Lock readLock = readWriteLock.readLock();
private static final Lock writeLock = readWriteLock.writeLock();
private static volatile boolean valid = false;
private static volatile boolean isThemed;
static volatile boolean xpStyleEnabled;
......@@ -70,7 +71,17 @@ public final class ThemeReader {
valid = false;
}
public static native boolean isThemed();
private static native boolean initThemes();
public static boolean isThemed() {
writeLock.lock();
try {
isThemed = initThemes();
return isThemed;
} finally {
writeLock.unlock();
}
}
public static boolean isXPStyleEnabled() {
return xpStyleEnabled;
......@@ -98,6 +109,9 @@ public final class ThemeReader {
// returns theme value
// this method should be invoked with readLock locked
private static Long getTheme(String widget) {
if (!isThemed) {
throw new IllegalStateException("Themes are not loaded");
}
if (!valid) {
readLock.unlock();
writeLock.lock();
......
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -225,7 +225,7 @@ BOOL InitThemes() {
return FALSE;
}
JNIEXPORT jboolean JNICALL Java_sun_awt_windows_ThemeReader_isThemed
JNIEXPORT jboolean JNICALL Java_sun_awt_windows_ThemeReader_initThemes
(JNIEnv *env, jclass klass) {
static BOOL TryLoadingThemeLib = FALSE;
static BOOL Themed = FALSE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册