This commit is contained in:
Joshua Granick
2015-09-04 11:56:36 -07:00
parent 8152f1f2db
commit f7ae00f635
3 changed files with 38 additions and 73 deletions

View File

@@ -10,7 +10,6 @@ import lime.audio.AudioSource;
import lime.audio.openal.AL;
import lime.audio.AudioBuffer;
import lime.graphics.Image;
import lime.system.ThreadPool;
import lime.text.Font;
import lime.utils.ByteArray;
import lime.utils.UInt8Array;
@@ -44,7 +43,6 @@ class DefaultAssetLibrary extends AssetLibrary {
public var type (default, null) = new Map <String, AssetType> ();
private var lastModified:Float;
private var threadPool:ThreadPool;
private var timer:Timer;
@@ -136,24 +134,6 @@ class DefaultAssetLibrary extends AssetLibrary {
}
private function createThreadPool ():Void {
threadPool = new ThreadPool (0, 2);
threadPool.doWork.add (function (id, data) {
data.result = data.getMethod (id);
threadPool.sendComplete (data.handler, data);
});
threadPool.onComplete.add (function (id, data) {
data.handler (data.result);
});
}
public override function exists (id:String, type:String):Bool {
var requestedType = type != null ? cast (type, AssetType) : null;
@@ -532,7 +512,7 @@ class DefaultAssetLibrary extends AssetLibrary {
#else
promise.complete (getAudioBuffer (id));
promise.completeWith (new Future<AudioBuffer> (function () return getAudioBuffer (id)));
#end
@@ -620,13 +600,7 @@ class DefaultAssetLibrary extends AssetLibrary {
#else
if (threadPool == null) {
createThreadPool ();
}
threadPool.queue (id, { promise: promise, getMethod: getBytes });
promise.completeWith (new Future<ByteArray> (function () return getBytes (id)));
#end
@@ -693,13 +667,7 @@ class DefaultAssetLibrary extends AssetLibrary {
#else
if (threadPool == null) {
createThreadPool ();
}
threadPool.queue (id, { promise: promise, getMethod: getImage });
promise.completeWith (new Future<Image> (function () return getImage (id)));
#end