Cache URLs for performance improvement.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I
2010-03-03 02:36:40 -08:00
parent e90c84ee81
commit 4bd6aca0c0
2 changed files with 92 additions and 3 deletions
+7 -1
View File
@@ -20,12 +20,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
var ExecutableUnloadedFileDependencies = 0,
ExecutableLoadingFileDependencies = 1,
ExecutableLoadedFileDependencies = 2,
AnonymousExecutableCount = 0;
function Executable(/*String*/ aCode, /*Array*/ fileDependencies, /*CFURL*/ aURL, /*Function*/ aFunction)
{
if (arguments.length === 0)
@@ -366,6 +366,9 @@ Executable.fileImporterForURL = function(/*CFURL*/ aURL)
{
cachedImporter = function(/*CFURL*/ aURL, /*BOOL*/ isQuoted, /*Function*/ aCallback)
{
// We make heavy use of URLs throughout this process, so cache them!
enableCFURLCaching();
aURL = new CFURL(aURL, isQuoted ? referenceURL : NULL);
var fileExecutableSearch = new FileExecutableSearch(aURL, isQuoted);
@@ -377,6 +380,9 @@ Executable.fileImporterForURL = function(/*CFURL*/ aURL)
{
fileExecutable.execute();
// No more need to cache these.
disableCFURLCaching();
if (aCallback)
aCallback();
}