src/jdk.unsupported.desktop/share/classes/jdk/swing/interop/DispatcherWrapper.java
author mdoerr
Tue, 12 Nov 2019 16:13:16 +0100
changeset 59032 ad05ed6f2a77
parent 50656 362e45aeb983
permissions -rw-r--r--
8233820: Test crashed with assert(phi->operand_count() != 1 || phi->subst() != phi) failed: missed trivial simplification Summary: Verification code needs to skip illegal phi functions. Reviewed-by: thartmann, vlivanov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50656
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     1
/*
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     4
 *
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    10
 *
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    15
 * accompanied this code).
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    16
 *
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    20
 *
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    23
 * questions.
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    24
 */
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    25
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    26
package jdk.swing.interop;
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    27
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    28
import java.awt.SecondaryLoop;
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    29
import java.awt.EventQueue;
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    30
import sun.awt.FwDispatcher;
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    31
import sun.awt.AWTAccessor;
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    32
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    33
/**
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    34
 * This class provides a wrapper over inner class DispatcherProxy
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    35
 * which implements jdk internal sun.awt.FwDispatcher interface
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    36
 * and provides APIs to be used by FX swing interop to access and use
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    37
 * FwDispatcher APIs.
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    38
 *
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    39
 * @since 11
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    40
 */
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    41
public abstract class DispatcherWrapper {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    42
    private DispatcherProxy fwd;
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    43
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    44
    public DispatcherWrapper() {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    45
        fwd = new DispatcherProxy();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    46
    }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    47
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    48
    public abstract boolean isDispatchThread();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    49
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    50
    public abstract void scheduleDispatch(Runnable r);
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    51
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    52
    public abstract SecondaryLoop createSecondaryLoop();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    53
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    54
    public static void setFwDispatcher(EventQueue eventQueue, DispatcherWrapper dispatcher) {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    55
        AWTAccessor.getEventQueueAccessor().setFwDispatcher(eventQueue, dispatcher.fwd);
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    56
    }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    57
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    58
    private class DispatcherProxy implements FwDispatcher {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    59
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    60
        @Override
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    61
        public boolean isDispatchThread() {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    62
            return DispatcherWrapper.this.isDispatchThread();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    63
        }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    64
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    65
        @Override
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    66
        public void scheduleDispatch(Runnable r) {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    67
            DispatcherWrapper.this.scheduleDispatch(r);
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    68
        }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    69
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    70
        @Override
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    71
        public SecondaryLoop createSecondaryLoop() {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    72
            return DispatcherWrapper.this.createSecondaryLoop();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    73
        }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    74
    }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    75
}