History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/sun/awt/image/ImageConsumerQueue.java (1 of 18352 files). Show all

Unified · Split

java/pkg/sun/awt/image/ImageConsumerQueue.java+94−0
@@ -0,0 +1,94 @@
1/*
2 * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package sun.awt.image;
27
28import java.awt.image.ImageConsumer;
29
30class ImageConsumerQueue {
31 ImageConsumerQueue next;
32
33 ImageConsumer consumer;
34 boolean interested;
35
36 Object securityContext;
37 boolean secure;
38
39 static ImageConsumerQueue removeConsumer(ImageConsumerQueue cqbase,
40 ImageConsumer ic,
41 boolean stillinterested)
42 {
43 ImageConsumerQueue cqprev = null;
44 for (ImageConsumerQueue cq = cqbase; cq != null; cq = cq.next) {
45 if (cq.consumer == ic) {
46 if (cqprev == null) {
47 cqbase = cq.next;
48 } else {
49 cqprev.next = cq.next;
50 }
51 cq.interested = stillinterested;
52 break;
53 }
54 cqprev = cq;
55 }
56 return cqbase;
57 }
58
59 static boolean isConsumer(ImageConsumerQueue cqbase, ImageConsumer ic) {
60 for (ImageConsumerQueue cq = cqbase; cq != null; cq = cq.next) {
61 if (cq.consumer == ic) {
62 return true;
63 }
64 }
65 return false;
66 }
67
68 ImageConsumerQueue(InputStreamImageSource src, ImageConsumer ic) {
69 consumer = ic;
70 interested = true;
71 // ImageReps do their own security at access time.
72 if (ic instanceof ImageRepresentation) {
73 ImageRepresentation ir = (ImageRepresentation) ic;
74 if (ir.image.source != src) {
75 throw new SecurityException("ImageRep added to wrong image source");
76 }
77 secure = true;
78 } else {
79 SecurityManager security = System.getSecurityManager();
80 if (security != null) {
81 securityContext = security.getSecurityContext();
82 } else {
83 securityContext = null;
84 }
85 }
86 }
87
88 public String toString() {
89 return ("[" + consumer +
90 ", " + (interested ? "" : "not ") + "interested" +
91 (securityContext != null ? ", " + securityContext : "") +
92 "]");
93 }
94}