Java Code Examples for sun.java2d.Disposer#pollingQueue()

The following examples show how to use sun.java2d.Disposer#pollingQueue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StrikeCache.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
static void disposeStrike(final FontStrikeDisposer disposer) {
    // we need to execute the strike disposal on the rendering thread
    // because they may be accessed on that thread at the time of the
    // disposal (for example, when the accel. cache is invalidated)

    // Whilst this is a bit heavyweight, in most applications
    // strike disposal is a relatively infrequent operation, so it
    // doesn't matter. But in some tests that use vast numbers
    // of strikes, the switching back and forth is measurable.
    // So the "pollRemove" call is added to batch up the work.
    // If we are polling we know we've already been called back
    // and can directly dispose the record.
    // Also worrisome is the necessity of getting a GC here.

    if (Disposer.pollingQueue) {
        doDispose(disposer);
        return;
    }

    RenderQueue rq = null;
    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!ge.isHeadless()) {
        GraphicsConfiguration gc =
            ge.getDefaultScreenDevice().getDefaultConfiguration();
        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
            BufferedContext bc = agc.getContext();
            if (bc != null) {
                rq = bc.getRenderQueue();
            }
        }
    }
    if (rq != null) {
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    doDispose(disposer);
                    Disposer.pollRemove();
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        doDispose(disposer);
    }
}
 
Example 2
Source File: StrikeCache.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
static void disposeStrike(final FontStrikeDisposer disposer) {
    // we need to execute the strike disposal on the rendering thread
    // because they may be accessed on that thread at the time of the
    // disposal (for example, when the accel. cache is invalidated)

    // Whilst this is a bit heavyweight, in most applications
    // strike disposal is a relatively infrequent operation, so it
    // doesn't matter. But in some tests that use vast numbers
    // of strikes, the switching back and forth is measurable.
    // So the "pollRemove" call is added to batch up the work.
    // If we are polling we know we've already been called back
    // and can directly dispose the record.
    // Also worrisome is the necessity of getting a GC here.

    if (Disposer.pollingQueue) {
        doDispose(disposer);
        return;
    }

    RenderQueue rq = null;
    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!ge.isHeadless()) {
        GraphicsConfiguration gc =
            ge.getDefaultScreenDevice().getDefaultConfiguration();
        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
            BufferedContext bc = agc.getContext();
            if (bc != null) {
                rq = bc.getRenderQueue();
            }
        }
    }
    if (rq != null) {
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    doDispose(disposer);
                    Disposer.pollRemove();
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        doDispose(disposer);
    }
}
 
Example 3
Source File: StrikeCache.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
static void disposeStrike(final FontStrikeDisposer disposer) {
    // we need to execute the strike disposal on the rendering thread
    // because they may be accessed on that thread at the time of the
    // disposal (for example, when the accel. cache is invalidated)

    // Whilst this is a bit heavyweight, in most applications
    // strike disposal is a relatively infrequent operation, so it
    // doesn't matter. But in some tests that use vast numbers
    // of strikes, the switching back and forth is measurable.
    // So the "pollRemove" call is added to batch up the work.
    // If we are polling we know we've already been called back
    // and can directly dispose the record.
    // Also worrisome is the necessity of getting a GC here.

    if (Disposer.pollingQueue) {
        doDispose(disposer);
        return;
    }

    RenderQueue rq = null;
    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!ge.isHeadless()) {
        GraphicsConfiguration gc =
            ge.getDefaultScreenDevice().getDefaultConfiguration();
        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
            BufferedContext bc = agc.getContext();
            if (bc != null) {
                rq = bc.getRenderQueue();
            }
        }
    }
    if (rq != null) {
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    doDispose(disposer);
                    Disposer.pollRemove();
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        doDispose(disposer);
    }
}
 
Example 4
Source File: StrikeCache.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
static void disposeStrike(final FontStrikeDisposer disposer) {
    // we need to execute the strike disposal on the rendering thread
    // because they may be accessed on that thread at the time of the
    // disposal (for example, when the accel. cache is invalidated)

    // Whilst this is a bit heavyweight, in most applications
    // strike disposal is a relatively infrequent operation, so it
    // doesn't matter. But in some tests that use vast numbers
    // of strikes, the switching back and forth is measurable.
    // So the "pollRemove" call is added to batch up the work.
    // If we are polling we know we've already been called back
    // and can directly dispose the record.
    // Also worrisome is the necessity of getting a GC here.

    if (Disposer.pollingQueue) {
        doDispose(disposer);
        return;
    }

    RenderQueue rq = null;
    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!ge.isHeadless()) {
        GraphicsConfiguration gc =
            ge.getDefaultScreenDevice().getDefaultConfiguration();
        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
            BufferedContext bc = agc.getContext();
            if (bc != null) {
                rq = bc.getRenderQueue();
            }
        }
    }
    if (rq != null) {
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    doDispose(disposer);
                    Disposer.pollRemove();
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        doDispose(disposer);
    }
}
 
Example 5
Source File: StrikeCache.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
static void disposeStrike(final FontStrikeDisposer disposer) {
    // we need to execute the strike disposal on the rendering thread
    // because they may be accessed on that thread at the time of the
    // disposal (for example, when the accel. cache is invalidated)

    // Whilst this is a bit heavyweight, in most applications
    // strike disposal is a relatively infrequent operation, so it
    // doesn't matter. But in some tests that use vast numbers
    // of strikes, the switching back and forth is measurable.
    // So the "pollRemove" call is added to batch up the work.
    // If we are polling we know we've already been called back
    // and can directly dispose the record.
    // Also worrisome is the necessity of getting a GC here.

    if (Disposer.pollingQueue) {
        doDispose(disposer);
        return;
    }

    RenderQueue rq = null;
    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!ge.isHeadless()) {
        GraphicsConfiguration gc =
            ge.getDefaultScreenDevice().getDefaultConfiguration();
        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
            BufferedContext bc = agc.getContext();
            if (bc != null) {
                rq = bc.getRenderQueue();
            }
        }
    }
    if (rq != null) {
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    doDispose(disposer);
                    Disposer.pollRemove();
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        doDispose(disposer);
    }
}
 
Example 6
Source File: StrikeCache.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
static void disposeStrike(final FontStrikeDisposer disposer) {
    // we need to execute the strike disposal on the rendering thread
    // because they may be accessed on that thread at the time of the
    // disposal (for example, when the accel. cache is invalidated)

    // Whilst this is a bit heavyweight, in most applications
    // strike disposal is a relatively infrequent operation, so it
    // doesn't matter. But in some tests that use vast numbers
    // of strikes, the switching back and forth is measurable.
    // So the "pollRemove" call is added to batch up the work.
    // If we are polling we know we've already been called back
    // and can directly dispose the record.
    // Also worrisome is the necessity of getting a GC here.

    if (Disposer.pollingQueue) {
        doDispose(disposer);
        return;
    }

    RenderQueue rq = null;
    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!GraphicsEnvironment.isHeadless()) {
        GraphicsConfiguration gc =
            ge.getDefaultScreenDevice().getDefaultConfiguration();
        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
            BufferedContext bc = agc.getContext();
            if (bc != null) {
                rq = bc.getRenderQueue();
            }
        }
    }
    if (rq != null) {
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    doDispose(disposer);
                    Disposer.pollRemove();
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        doDispose(disposer);
    }
}
 
Example 7
Source File: StrikeCache.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
static void disposeStrike(final FontStrikeDisposer disposer) {
    // we need to execute the strike disposal on the rendering thread
    // because they may be accessed on that thread at the time of the
    // disposal (for example, when the accel. cache is invalidated)

    // Whilst this is a bit heavyweight, in most applications
    // strike disposal is a relatively infrequent operation, so it
    // doesn't matter. But in some tests that use vast numbers
    // of strikes, the switching back and forth is measurable.
    // So the "pollRemove" call is added to batch up the work.
    // If we are polling we know we've already been called back
    // and can directly dispose the record.
    // Also worrisome is the necessity of getting a GC here.

    if (Disposer.pollingQueue) {
        doDispose(disposer);
        return;
    }

    RenderQueue rq = null;
    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!GraphicsEnvironment.isHeadless()) {
        GraphicsConfiguration gc =
            ge.getDefaultScreenDevice().getDefaultConfiguration();
        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
            BufferedContext bc = agc.getContext();
            if (bc != null) {
                rq = bc.getRenderQueue();
            }
        }
    }
    if (rq != null) {
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    doDispose(disposer);
                    Disposer.pollRemove();
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        doDispose(disposer);
    }
}
 
Example 8
Source File: StrikeCache.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
static void disposeStrike(final FontStrikeDisposer disposer) {
    // we need to execute the strike disposal on the rendering thread
    // because they may be accessed on that thread at the time of the
    // disposal (for example, when the accel. cache is invalidated)

    // Whilst this is a bit heavyweight, in most applications
    // strike disposal is a relatively infrequent operation, so it
    // doesn't matter. But in some tests that use vast numbers
    // of strikes, the switching back and forth is measurable.
    // So the "pollRemove" call is added to batch up the work.
    // If we are polling we know we've already been called back
    // and can directly dispose the record.
    // Also worrisome is the necessity of getting a GC here.

    if (Disposer.pollingQueue) {
        doDispose(disposer);
        return;
    }

    RenderQueue rq = null;
    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!ge.isHeadless()) {
        GraphicsConfiguration gc =
            ge.getDefaultScreenDevice().getDefaultConfiguration();
        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
            BufferedContext bc = agc.getContext();
            if (bc != null) {
                rq = bc.getRenderQueue();
            }
        }
    }
    if (rq != null) {
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    doDispose(disposer);
                    Disposer.pollRemove();
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        doDispose(disposer);
    }
}
 
Example 9
Source File: StrikeCache.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
static void disposeStrike(final FontStrikeDisposer disposer) {
    // we need to execute the strike disposal on the rendering thread
    // because they may be accessed on that thread at the time of the
    // disposal (for example, when the accel. cache is invalidated)

    // Whilst this is a bit heavyweight, in most applications
    // strike disposal is a relatively infrequent operation, so it
    // doesn't matter. But in some tests that use vast numbers
    // of strikes, the switching back and forth is measurable.
    // So the "pollRemove" call is added to batch up the work.
    // If we are polling we know we've already been called back
    // and can directly dispose the record.
    // Also worrisome is the necessity of getting a GC here.

    if (Disposer.pollingQueue) {
        doDispose(disposer);
        return;
    }

    RenderQueue rq = null;
    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!ge.isHeadless()) {
        GraphicsConfiguration gc =
            ge.getDefaultScreenDevice().getDefaultConfiguration();
        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
            BufferedContext bc = agc.getContext();
            if (bc != null) {
                rq = bc.getRenderQueue();
            }
        }
    }
    if (rq != null) {
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    doDispose(disposer);
                    Disposer.pollRemove();
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        doDispose(disposer);
    }
}
 
Example 10
Source File: StrikeCache.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
static void disposeStrike(final FontStrikeDisposer disposer) {
    // we need to execute the strike disposal on the rendering thread
    // because they may be accessed on that thread at the time of the
    // disposal (for example, when the accel. cache is invalidated)

    // Whilst this is a bit heavyweight, in most applications
    // strike disposal is a relatively infrequent operation, so it
    // doesn't matter. But in some tests that use vast numbers
    // of strikes, the switching back and forth is measurable.
    // So the "pollRemove" call is added to batch up the work.
    // If we are polling we know we've already been called back
    // and can directly dispose the record.
    // Also worrisome is the necessity of getting a GC here.

    if (Disposer.pollingQueue) {
        doDispose(disposer);
        return;
    }

    RenderQueue rq = null;
    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!ge.isHeadless()) {
        GraphicsConfiguration gc =
            ge.getDefaultScreenDevice().getDefaultConfiguration();
        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
            BufferedContext bc = agc.getContext();
            if (bc != null) {
                rq = bc.getRenderQueue();
            }
        }
    }
    if (rq != null) {
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    doDispose(disposer);
                    Disposer.pollRemove();
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        doDispose(disposer);
    }
}
 
Example 11
Source File: StrikeCache.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
static void disposeStrike(final FontStrikeDisposer disposer) {
    // we need to execute the strike disposal on the rendering thread
    // because they may be accessed on that thread at the time of the
    // disposal (for example, when the accel. cache is invalidated)

    // Whilst this is a bit heavyweight, in most applications
    // strike disposal is a relatively infrequent operation, so it
    // doesn't matter. But in some tests that use vast numbers
    // of strikes, the switching back and forth is measurable.
    // So the "pollRemove" call is added to batch up the work.
    // If we are polling we know we've already been called back
    // and can directly dispose the record.
    // Also worrisome is the necessity of getting a GC here.

    if (Disposer.pollingQueue) {
        doDispose(disposer);
        return;
    }

    RenderQueue rq = null;
    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!ge.isHeadless()) {
        GraphicsConfiguration gc =
            ge.getDefaultScreenDevice().getDefaultConfiguration();
        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
            BufferedContext bc = agc.getContext();
            if (bc != null) {
                rq = bc.getRenderQueue();
            }
        }
    }
    if (rq != null) {
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    doDispose(disposer);
                    Disposer.pollRemove();
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        doDispose(disposer);
    }
}
 
Example 12
Source File: StrikeCache.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
static void disposeStrike(final FontStrikeDisposer disposer) {
    // we need to execute the strike disposal on the rendering thread
    // because they may be accessed on that thread at the time of the
    // disposal (for example, when the accel. cache is invalidated)

    // Whilst this is a bit heavyweight, in most applications
    // strike disposal is a relatively infrequent operation, so it
    // doesn't matter. But in some tests that use vast numbers
    // of strikes, the switching back and forth is measurable.
    // So the "pollRemove" call is added to batch up the work.
    // If we are polling we know we've already been called back
    // and can directly dispose the record.
    // Also worrisome is the necessity of getting a GC here.

    if (Disposer.pollingQueue) {
        doDispose(disposer);
        return;
    }

    RenderQueue rq = null;
    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!ge.isHeadless()) {
        GraphicsConfiguration gc =
            ge.getDefaultScreenDevice().getDefaultConfiguration();
        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
            BufferedContext bc = agc.getContext();
            if (bc != null) {
                rq = bc.getRenderQueue();
            }
        }
    }
    if (rq != null) {
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    doDispose(disposer);
                    Disposer.pollRemove();
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        doDispose(disposer);
    }
}
 
Example 13
Source File: StrikeCache.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
static void disposeStrike(final FontStrikeDisposer disposer) {
    // we need to execute the strike disposal on the rendering thread
    // because they may be accessed on that thread at the time of the
    // disposal (for example, when the accel. cache is invalidated)

    // Whilst this is a bit heavyweight, in most applications
    // strike disposal is a relatively infrequent operation, so it
    // doesn't matter. But in some tests that use vast numbers
    // of strikes, the switching back and forth is measurable.
    // So the "pollRemove" call is added to batch up the work.
    // If we are polling we know we've already been called back
    // and can directly dispose the record.
    // Also worrisome is the necessity of getting a GC here.

    if (Disposer.pollingQueue) {
        doDispose(disposer);
        return;
    }

    RenderQueue rq = null;
    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!ge.isHeadless()) {
        GraphicsConfiguration gc =
            ge.getDefaultScreenDevice().getDefaultConfiguration();
        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
            BufferedContext bc = agc.getContext();
            if (bc != null) {
                rq = bc.getRenderQueue();
            }
        }
    }
    if (rq != null) {
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    doDispose(disposer);
                    Disposer.pollRemove();
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        doDispose(disposer);
    }
}
 
Example 14
Source File: StrikeCache.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
static void disposeStrike(final FontStrikeDisposer disposer) {
    // we need to execute the strike disposal on the rendering thread
    // because they may be accessed on that thread at the time of the
    // disposal (for example, when the accel. cache is invalidated)

    // Whilst this is a bit heavyweight, in most applications
    // strike disposal is a relatively infrequent operation, so it
    // doesn't matter. But in some tests that use vast numbers
    // of strikes, the switching back and forth is measurable.
    // So the "pollRemove" call is added to batch up the work.
    // If we are polling we know we've already been called back
    // and can directly dispose the record.
    // Also worrisome is the necessity of getting a GC here.

    if (Disposer.pollingQueue) {
        doDispose(disposer);
        return;
    }

    RenderQueue rq = null;
    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!ge.isHeadless()) {
        GraphicsConfiguration gc =
            ge.getDefaultScreenDevice().getDefaultConfiguration();
        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
            BufferedContext bc = agc.getContext();
            if (bc != null) {
                rq = bc.getRenderQueue();
            }
        }
    }
    if (rq != null) {
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    doDispose(disposer);
                    Disposer.pollRemove();
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        doDispose(disposer);
    }
}