javauis/javalegacyutils/src/eventserver/CJavaEventSourceBase.cpp
changeset 76 4ad59aaee882
parent 69 773449708c84
child 79 2f468c1958d0
equal deleted inserted replaced
69:773449708c84 76:4ad59aaee882
     1 /*
       
     2 * Copyright (c) 1999-2001 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 
       
    18 
       
    19 #include <mevents.h>
       
    20 #include "CJavaEventServer.h"
       
    21 
       
    22 EXPORT_C CJavaEventSourceBase::CJavaEventSourceBase()
       
    23 {}
       
    24 
       
    25 EXPORT_C CJavaEventSourceBase::~CJavaEventSourceBase()
       
    26 {
       
    27     // Must never be deleted directly
       
    28     ASSERT(iRef==-1);
       
    29     if (iServer.Handle())
       
    30     {
       
    31         iServer->RemoveRef();
       
    32     }
       
    33 }
       
    34 
       
    35 EXPORT_C void CJavaEventSourceBase::ConstructL(JNIEnv& aJni,jobject aPeer,TJavaEventServer aServer)
       
    36 //
       
    37 // Create a weak global reference to the Java object for event dispatching
       
    38 //
       
    39 {
       
    40     iServer=aServer;
       
    41     iServer->AddRef();
       
    42     iPeer=aJni.NewWeakGlobalRef(aPeer);
       
    43     if (!iPeer)
       
    44         User::Leave(KErrGeneral);   // exception is thrown on return to Java
       
    45 }
       
    46 
       
    47 EXPORT_C void CJavaEventSourceBase::FinalizeSvr()
       
    48 //
       
    49 // Default implementation for server-side finalization
       
    50 //
       
    51 {
       
    52 }
       
    53 
       
    54 EXPORT_C void CJavaEventSourceBase::FinalizeJni(JNIEnv&)
       
    55 //
       
    56 // Default implementation for Java-side finalization
       
    57 //
       
    58 {
       
    59 }