CreatedFontTracker.java revision 1121
1121N/A/*
1121N/A * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
1121N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1121N/A *
1121N/A * This code is free software; you can redistribute it and/or modify it
1121N/A * under the terms of the GNU General Public License version 2 only, as
1121N/A * published by the Free Software Foundation. Sun designates this
1121N/A * particular file as subject to the "Classpath" exception as provided
1121N/A * by Sun in the LICENSE file that accompanied this code.
1121N/A *
1121N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1121N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1121N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1121N/A * version 2 for more details (a copy is included in the LICENSE file that
1121N/A * accompanied this code).
1121N/A *
1121N/A * You should have received a copy of the GNU General Public License version
1121N/A * 2 along with this work; if not, write to the Free Software Foundation,
1121N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1121N/A *
1121N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
1121N/A * CA 95054 USA or visit www.sun.com if you need additional information or
1121N/A * have any questions.
1121N/A */
1121N/A
1121N/Apackage sun.font;
1121N/A
1121N/Apublic class CreatedFontTracker {
1121N/A
1121N/A public static final int MAX_FILE_SIZE = 32 * 1024 * 1024;
1121N/A public static final int MAX_TOTAL_BYTES = 10 * MAX_FILE_SIZE;
1121N/A
1121N/A static int numBytes;
1121N/A static CreatedFontTracker tracker;
1121N/A
1121N/A public static synchronized CreatedFontTracker getTracker() {
1121N/A if (tracker == null) {
1121N/A tracker = new CreatedFontTracker();
1121N/A }
1121N/A return tracker;
1121N/A }
1121N/A
1121N/A public synchronized int getNumBytes() {
1121N/A return numBytes;
1121N/A }
1121N/A
1121N/A public synchronized void addBytes(int sz) {
1121N/A numBytes += sz;
1121N/A }
1121N/A
1121N/A public synchronized void subBytes(int sz) {
1121N/A numBytes -= sz;
1121N/A }
1121N/A}