javauis/m3g_akn/src/jni/platform.inl
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 #include "javax_microedition_m3g_Platform.h"
       
    18 
       
    19 static void nativeFinalize(M3GObject hObj)
       
    20 {
       
    21     m3gDeleteObject(hObj);
       
    22 }
       
    23 
       
    24 static void deleteInterface(M3GInterface aM3g)
       
    25 {
       
    26     m3gDeleteInterface(aM3g);
       
    27 }
       
    28 
       
    29 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Platform_finalizeInterface
       
    30 (JNIEnv* aEnv, jclass, jint aHObj, jint aEventSourceHandle)
       
    31 {
       
    32     M3G_DO_LOCK
       
    33     // Call to the other thread in case OpenGL objects need to be
       
    34     // deleted
       
    35     CJavaM3GEventSource* eventSource = JavaUnhand<CJavaM3GEventSource>(aEventSourceHandle);
       
    36     eventSource->ExecuteV(&deleteInterface, (M3GInterface)aHObj);
       
    37     M3G_DO_UNLOCK(aEnv)
       
    38 
       
    39 }
       
    40 
       
    41 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Platform__1finalizeObject
       
    42 (JNIEnv* aEnv, jclass, jint aEventSourceHandle, jint aHObj)
       
    43 {
       
    44     M3G_DO_LOCK
       
    45     // Call to the other thread in case OpenGL objects need to be
       
    46     // deleted
       
    47     CJavaM3GEventSource* eventSource = JavaUnhand<CJavaM3GEventSource>(aEventSourceHandle);
       
    48     eventSource->ExecuteV(&nativeFinalize, (M3GObject)aHObj);
       
    49     M3G_DO_UNLOCK(aEnv)
       
    50 }