< prev index next >

openjfx9/modules/javafx.graphics/src/main/java/com/sun/marlin/OffHeapArray.java

Print this page

        

@@ -21,38 +21,37 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
-package sun.java2d.marlin;
+package com.sun.marlin;
 
-import static sun.java2d.marlin.MarlinConst.LOG_UNSAFE_MALLOC;
+import static com.sun.marlin.MarlinConst.LOG_UNSAFE_MALLOC;
 import jdk.internal.misc.Unsafe;
-import jdk.internal.ref.CleanerFactory;
 
 /**
  *
  * @author bourgesl
  */
-final class OffHeapArray  {
+public final class OffHeapArray  {
 
     // unsafe reference
-    static final Unsafe UNSAFE;
+    public static final Unsafe UNSAFE;
     // size of int / float
     static final int SIZE_INT;
 
     static {
         UNSAFE   = Unsafe.getUnsafe();
         SIZE_INT = Unsafe.ARRAY_INT_INDEX_SCALE;
     }
 
     /* members */
-    long address;
+    public long address;
     long length;
     int  used;
 
-    OffHeapArray(final Object parent, final long len) {
+    public OffHeapArray(final Object parent, final long len) {
         // note: may throw OOME:
         this.address = UNSAFE.allocateMemory(len);
         this.length  = len;
         this.used    = 0;
         if (LOG_UNSAFE_MALLOC) {

@@ -60,11 +59,11 @@
                                 + ": OffHeapArray.allocateMemory =   "
                                 + len + " to addr = " + this.address);
         }
 
         // Register a cleaning function to ensure freeing off-heap memory:
-        CleanerFactory.cleaner().register(parent, () -> this.free());
+        MarlinUtils.getCleaner().register(parent, () -> this.free());
     }
 
     /*
      * As realloc may change the address, updating address is MANDATORY
      * @param len new array length
< prev index next >