equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
16 */ |
16 */ |
17 |
17 |
18 package com.nokia.microedition.m2g; |
18 package com.nokia.microedition.m2g; |
19 |
19 |
20 import java.lang.ref.WeakReference; |
20 import java.lang.ref.WeakReference; |
21 //import com.nokia.mj.impl.rt.legacy.MIDEventServer; |
|
22 import java.util.Hashtable; |
21 import java.util.Hashtable; |
23 //import com.nokia.mj.impl.rt.legacy.MemoryUtil; |
|
24 import java.util.Enumeration; |
22 import java.util.Enumeration; |
25 import org.eclipse.swt.events.DisposeListener; |
23 import org.eclipse.swt.events.DisposeListener; |
26 import org.eclipse.swt.events.DisposeEvent; |
24 import org.eclipse.swt.events.DisposeEvent; |
27 import org.eclipse.swt.SWT; |
25 import org.eclipse.swt.SWT; |
28 import org.eclipse.swt.widgets.*; |
26 import org.eclipse.swt.widgets.*; |
52 * Constructor |
50 * Constructor |
53 */ |
51 */ |
54 private M2GManager() |
52 private M2GManager() |
55 { |
53 { |
56 super(); |
54 super(); |
57 |
55 |
58 |
56 // Execute in UI thread |
59 //As Display is created in Thread only.. So no need to handle display over here. |
57 Platform.executeInUIThread( |
60 //scom.nokia.mj.impl.rt.support.Jvm.loadSystemLibrary("javam2g"); |
58 new M2GRunnableQt() |
61 /*// setup the finalization via eswt's Display |
59 { |
62 Display display = Display.getCurrent(); |
60 public void doRun() |
63 if (display == null) |
61 { |
64 { |
62 iSVGProxyHandle = _createSvgProxy(); |
65 return; // ? |
63 } |
66 } |
64 }); |
67 display.addListener(SWT.Dispose, (Listener)this); */ |
|
68 |
|
69 |
|
70 // Execute in UI thread |
|
71 Platform.executeInUIThread( |
|
72 new M2GRunnableQt() { |
|
73 public void doRun() { |
|
74 iSVGProxyHandle = _createSvgProxy(); |
|
75 } |
|
76 }); |
|
77 M2GManager.heuristicGC(); |
65 M2GManager.heuristicGC(); |
78 } |
66 } |
79 |
67 |
80 /** |
68 /** |
81 * Impelements 'handleEvent' from Listener |
69 * Impelements 'handleEvent' from Listener |
181 M2GWeakManager weakManager = null; |
169 M2GWeakManager weakManager = null; |
182 synchronized (sQuard) |
170 synchronized (sQuard) |
183 { |
171 { |
184 if (sWeakManagerProxy != null) |
172 if (sWeakManagerProxy != null) |
185 { |
173 { |
186 |
174 |
187 weakManager = (M2GWeakManager)sWeakManagerProxy.get(); |
175 weakManager = (M2GWeakManager)sWeakManagerProxy.get(); |
188 } |
176 } |
189 // Check if object null |
177 // Check if object null |
190 if (weakManager == null) |
178 if (weakManager == null) |
191 { |
179 { |
192 // Create a new object and put it into the static member variable |
180 // Create a new object and put it into the static member variable |
193 |
181 |
194 weakManager = new M2GWeakManager(new M2GManager()); |
182 weakManager = new M2GWeakManager(new M2GManager()); |
195 sWeakManagerProxy = new WeakReference(weakManager); |
183 sWeakManagerProxy = new WeakReference(weakManager); |
196 } |
184 } |
197 return weakManager.getInstance(); |
185 return weakManager.getInstance(); |
198 } |
186 } |
207 } |
195 } |
208 |
196 |
209 //-------------------------------------------------- |
197 //-------------------------------------------------- |
210 // NATIVE METHODS |
198 // NATIVE METHODS |
211 //-------------------------------------------------- |
199 //-------------------------------------------------- |
212 private static native int _createSvgEngine(int aSvgProxyHandle ); |
200 private static native int _createSvgEngine(int aSvgProxyHandle); |
213 |
201 |
214 private static native int _createSvgProxy(); |
202 private static native int _createSvgProxy(); |
215 |
203 |
216 private static native void _deleteSvgEngine(int aSvgProxyHandle, int aSvgEngineHandle); |
204 private static native void _deleteSvgEngine(int aSvgProxyHandle, int aSvgEngineHandle); |
217 |
205 |
218 private static native void _deleteSvgProxy( int aSvgProxyHandle); |
206 private static native void _deleteSvgProxy(int aSvgProxyHandle); |
219 |
207 |
220 |
208 |
221 } |
209 } |
222 |
210 |
223 //-------------------------------------------------- |
211 //-------------------------------------------------- |