HELLO·Android
系统源代码
IT资讯
技术文章
我的收藏
注册
登录
-
我收藏的文章
创建代码块
我的代码块
我的账号
Jelly Bean MR1
|
4.2.2_r1
下载
查看原文件
收藏
根目录
cts
suite
pts
hostTests
browser
browserlauncher
assets
octane
code-load.js
// Copyright 2012 the Octane Benchmark project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // The code in BASE_JS below: // Copyright 2012 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS-IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // The code in JQUERY_JS below: // Copyright (c) 2012 John Resig, http://jquery.com/ // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. var CodeLoad = new BenchmarkSuite('CodeLoad', 450000, [ new Benchmark('CodeLoadClosure', runCodeLoadClosure, setupCodeLoad, tearDownCodeLoad, 16), new Benchmark('CodeLoadJQuery', runCodeLoadJQuery, setupCodeLoad, tearDownCodeLoad, 16) ]); var salt; var indirectEval; function setupCodeLoad() { salt = 0; indirectEval = eval; } function tearDownCodeLoad() { salt = null; indirectEval = null; } function runCodeLoadClosure() { runClosure(); salt++; } function runCodeLoadJQuery() { runJQuery(); salt++; } /* * BASE_JS is a compiled and formatted version of: * http://code.google.com/p/closure-library/source/browse/trunk/closure/goog/base.js * JQUERY_JS is a formatted copy of: * http://code.jquery.com/jquery.min.js * The following Python script generates both variables: #!/usr/bin/env python import urllib import urllib2 def escape_and_format(data, varname): data = data.replace("\n", " ").replace("; ", ";") data = data.replace("\\", "\\\\").replace("\"", "\\\"") data = "var " + varname + " = \"" + data + "\"" while len(data) > 0: cutoff = min(79, len(data)) while data[cutoff-1] == '\\': cutoff -= 1 line = data[0:cutoff] data = data[cutoff:] if len(data) > 0: line += '\\' print line url = "http://closure-compiler.appspot.com/compile" request_params = {"output_format": "text", "compilation_level": "SIMPLE_OPTIMIZATIONS", "use_closure_library": "true", "js_code": "", "output_info": "compiled_code"} result = urllib2.urlopen(url, urllib.urlencode(request_params)) escape_and_format(result.read(), "BASE_JS") print "\n\n" url = "http://code.jquery.com/jquery.min.js" result = urllib2.urlopen(url) escape_and_format(result.read(), "JQUERY_JS") */ var BASE_JS = "var COMPILED=!0,goog=goog||{};goog.global=this;goog.DEBUG=!0;goo\ g.LOCALE=\"en\";goog.provide=function(a){if(!COMPILED){if(goog.isProvided_(a))t\ hrow Error('Namespace \"'+a+'\" already declared.');delete goog.implicitNamespa\ ces_[a];for(var b=a;(b=b.substring(0,b.lastIndexOf(\".\")))&&!goog.getObjectByN\ ame(b);)goog.implicitNamespaces_[b]=!0}goog.exportPath_(a)};goog.setTestOnly=fu\ nction(a){if(COMPILED&&!goog.DEBUG)throw a=a||\"\",Error(\"Importing test-only \ code into non-debug environment\"+a?\": \"+a:\".\");};COMPILED||(goog.isProvide\ d_=function(a){return!goog.implicitNamespaces_[a]&&!!goog.getObjectByName(a)},g\ oog.implicitNamespaces_={});goog.exportPath_=function(a,b,c){a=a.split(\".\");c\ =c||goog.global;!(a[0]in c)&&c.execScript&&c.execScript(\"var \"+a[0]);for(var \ d;a.length&&(d=a.shift());)!a.length&&goog.isDef(b)?c[d]=b:c=c[d]?c[d]:c[d]={}}\ ;goog.getObjectByName=function(a,b){for(var c=a.split(\".\"),d=b||goog.global,e\ ;e=c.shift();)if(goog.isDefAndNotNull(d[e]))d=d[e];else return null;return d};g\ oog.globalize=function(a,b){var c=b||goog.global,d;for(d in a)c[d]=a[d]};goog.a\ ddDependency=function(a,b,c){if(!COMPILED){for(var d,a=a.replace(/\\\\/g,\"/\")\ ,e=goog.dependencies_,g=0;d=b[g];g++){e.nameToPath[d]=a;a in e.pathToNames||(e.\ pathToNames[a]={});e.pathToNames[a][d]=true}for(d=0;b=c[d];d++){a in e.requires\ ||(e.requires[a]={});e.requires[a][b]=true}}};goog.ENABLE_DEBUG_LOADER=!0;goog.\ require=function(a){if(!COMPILED&&!goog.isProvided_(a)){if(goog.ENABLE_DEBUG_LO\ ADER){var b=goog.getPathFromDeps_(a);if(b){goog.included_[b]=true;goog.writeScr\ ipts_();return}}a=\"goog.require could not find: \"+a;goog.global.console&&goog\ .global.console.error(a);throw Error(a);}};goog.basePath=\"\";goog.nullFunction\ =function(){};goog.identityFunction=function(a){return a};goog.abstractMethod=f\ unction(){throw Error(\"unimplemented abstract method\");};goog.addSingletonGet\ ter=function(a){a.getInstance=function(){return a.instance_||(a.instance_=new a\ )}};!COMPILED&&goog.ENABLE_DEBUG_LOADER&&(goog.included_={},goog.dependencies_=\ {pathToNames:{},nameToPath:{},requires:{},visited:{},written:{}},goog.inHtmlDoc\ ument_=function(){var a=goog.global.document;return typeof a!=\"undefined\"&&\"\ write\"in a},goog.findBasePath_=function(){if(goog.global.CLOSURE_BASE_PATH)goo\ g.basePath=goog.global.CLOSURE_BASE_PATH;else if(goog.inHtmlDocument_())for(var\ a=goog.global.document.getElementsByTagName(\"script\"),b=a.length-1;b>=0;--b)\ {var c=a[b].src,d=c.lastIndexOf(\"?\"), d=d==-1?c.length:d;if(c.substr(d-7,7)==\ \"base.js\"){goog.basePath=c.substr(0,d-7);break}}},goog.importScript_=function\ (a){var b=goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_;!goog.depende\ ncies_.written[a]&&b(a)&&(goog.dependencies_.written[a]=true)},goog.writeScript\ Tag_=function(a){if(goog.inHtmlDocument_()){goog.global.document.write('
登录后可以享受更多权益
您还没有登录,登录后您可以:
收藏Android系统代码
收藏喜欢的文章
多个平台共享账号
去登录
首次使用?从这里
注册