[libbluray-devel] Per-xlet HSceneFactory
hpi1
git at videolan.org
Mon Apr 8 11:21:59 CEST 2013
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Apr 8 11:56:14 2013 +0300| [56b461123e3118e8c8556586060abb549282d88a] | committer: hpi1
Per-xlet HSceneFactory
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=56b461123e3118e8c8556586060abb549282d88a
---
.../bdj/java/org/havi/ui/HSceneFactory.java | 18 ++++++++++-----
.../bdj/java/org/videolan/BDJAppProxy.java | 6 +----
.../bdj/java/org/videolan/BDJXletContext.java | 24 ++++++++++++++++++++
src/libbluray/bdj/java/org/videolan/Libbluray.java | 1 -
4 files changed, 37 insertions(+), 12 deletions(-)
diff --git a/src/libbluray/bdj/java/org/havi/ui/HSceneFactory.java b/src/libbluray/bdj/java/org/havi/ui/HSceneFactory.java
index b09c6d4..ce8d076 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HSceneFactory.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HSceneFactory.java
@@ -20,13 +20,24 @@
package org.havi.ui;
import org.videolan.GUIManager;
+import org.videolan.BDJXletContext;
public class HSceneFactory extends Object {
private HSceneFactory() {
}
public static HSceneFactory getInstance() {
- return instance;
+ BDJXletContext context = BDJXletContext.getCurrentContext();
+ if (context != null) {
+ if (context.getSceneFactory() == null) {
+ context.setSceneFactory(new HSceneFactory());
+ }
+ return context.getSceneFactory();
+ }
+
+ org.videolan.Logger.getLogger("HSceneFactory").error("getInstance(): no context at " + org.videolan.Logger.dumpStack());
+
+ return null;
}
public HSceneTemplate getBestSceneTemplate(HSceneTemplate template) {
@@ -96,10 +107,5 @@ public class HSceneFactory extends Object {
}
}
- public static void shutdown() {
- instance.dispose();
- }
-
private HScene defaultHScene = null;
- private static final HSceneFactory instance = new HSceneFactory();
}
diff --git a/src/libbluray/bdj/java/org/videolan/BDJAppProxy.java b/src/libbluray/bdj/java/org/videolan/BDJAppProxy.java
index 824c171..63b2716 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJAppProxy.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJAppProxy.java
@@ -147,11 +147,7 @@ public class BDJAppProxy implements DVBJProxy, Runnable {
}
- EventQueue eq = context.getEventQueue();
- context.setEventQueue(null);
- if (eq != null) {
- GUIManager.stopEventQueue(eq);
- }
+ context.release();
}
public void addAppStateChangeEventListener(AppStateChangeEventListener listener) {
diff --git a/src/libbluray/bdj/java/org/videolan/BDJXletContext.java b/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
index 5112cbe..9290a49 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
@@ -28,6 +28,7 @@ import javax.microedition.xlet.UnavailableContainerException;
import org.dvb.application.AppID;
import org.dvb.application.AppProxy;
import org.dvb.application.AppsDatabase;
+import org.havi.ui.HSceneFactory;
import org.videolan.bdjo.AppCache;
import org.videolan.bdjo.AppEntry;
@@ -90,6 +91,15 @@ public class BDJXletContext implements javax.tv.xlet.XletContext, javax.microedi
return eventQueue;
}
+ public void setSceneFactory(HSceneFactory f) {
+ sceneFactory = f;
+ }
+
+ public HSceneFactory getSceneFactory() {
+ return sceneFactory;
+ }
+
+
public static BDJXletContext getCurrentContext() {
Object obj = AccessController.doPrivileged(
new PrivilegedAction() {
@@ -119,9 +129,23 @@ public class BDJXletContext implements javax.tv.xlet.XletContext, javax.microedi
entry.getInitialClass());
}
+ protected void release() {
+ if (sceneFactory != null) {
+ sceneFactory.dispose();
+ sceneFactory = null;
+ }
+
+ EventQueue eq = eventQueue;
+ eventQueue = null;
+ if (eq != null) {
+ GUIManager.stopEventQueue(eq);
+ }
+ }
+
private String[] args;
private AppID appid;
private BDJClassLoader loader;
private Container container;
private EventQueue eventQueue = null;
+ private HSceneFactory sceneFactory = null;
}
diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index 4ec7134..a5074a0 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -126,7 +126,6 @@ public class Libbluray {
BDJLoader.shutdown();
BDJActionManager.getInstance().finalize();
MountManager.unmountAll();
- org.havi.ui.HSceneFactory.shutdown();
GUIManager.shutdown();
BDToolkit.shutdown();
} catch (Throwable e) {
More information about the libbluray-devel
mailing list