Multi thread AS search

This commit is contained in:
honfika@gmail.com
2016-12-24 18:52:09 +01:00
parent 40e31a5f99
commit 5f2ffd0089
18 changed files with 1277 additions and 789 deletions

View File

@@ -0,0 +1,69 @@
/*
* Copyright (C) 2010-2016 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.cache;
import com.jpexs.decompiler.flash.action.ActionList;
import com.jpexs.decompiler.flash.helpers.HighlightedText;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.helpers.Cache;
/**
*
* @author JPEXS
*/
public class AS2Cache {
private final Cache<ASMSource, HighlightedText> cache = Cache.getInstance(true, false, "as2");
private final Cache<ASMSource, ActionList> pcodeCache = Cache.getInstance(true, true, "as2pcode");
public void clear() {
pcodeCache.clear();
cache.clear();
}
public boolean isCached(ASMSource src) {
return cache.contains(src);
}
public boolean isPcodeCached(ASMSource src) {
return pcodeCache.contains(src);
}
public HighlightedText get(ASMSource src) {
return cache.get(src);
}
public ActionList getPcode(ASMSource src) {
return pcodeCache.get(src);
}
public void put(ASMSource src, HighlightedText text) {
cache.put(src, text);
}
public void put(ASMSource src, ActionList actionList) {
pcodeCache.put(src, actionList);
}
public void remove(ASMSource src) {
if (src != null) {
cache.remove(src);
pcodeCache.remove(src);
}
}
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (C) 2010-2016 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.cache;
import com.jpexs.decompiler.flash.abc.ScriptPack;
import com.jpexs.decompiler.flash.helpers.HighlightedText;
import com.jpexs.helpers.Cache;
/**
*
* @author JPEXS
*/
public class AS3Cache {
private final Cache<ScriptPack, HighlightedText> cache = Cache.getInstance(true, false, "as3");
public void clear() {
cache.clear();
}
public boolean isCached(ScriptPack pack) {
return cache.contains(pack);
}
public HighlightedText get(ScriptPack pack) {
return cache.get(pack);
}
public void put(ScriptPack pack, HighlightedText text) {
cache.put(pack, text);
}
public void remove(ScriptPack pack) {
if (pack != null) {
cache.remove(pack);
}
}
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2010-2016 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.cache;
/**
*
* @author JPEXS
*/
@FunctionalInterface
public interface ScriptDecompiledListener<T> {
public void onComplete(T result);
}