summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2012-02-17 16:47:06 +0000
committerSteve Block <steveblock@google.com>2012-02-21 11:49:49 +0000
commit13c343328386eea539a0c767c2f5d62b1440cbf3 (patch)
treeb499855698567092b9553256044fc8a474ca3900
parent61c64bd8200079056c911962a23938b22f9f09b3 (diff)
downloadexternal_webkit-13c343328386eea539a0c767c2f5d62b1440cbf3.zip
external_webkit-13c343328386eea539a0c767c2f5d62b1440cbf3.tar.gz
external_webkit-13c343328386eea539a0c767c2f5d62b1440cbf3.tar.bz2
Remove benchmark tool
This relies on use of the Android HTTP stack, which hasn't been used since before HC, so is of little value. Bug: 5458617 Change-Id: I6312736cb139cd7a4e295e1cb6390d2a797fd37b
-rw-r--r--Android.mk3
-rw-r--r--Source/WebKit/Android.mk3
-rw-r--r--Source/WebKit/android/benchmark/Android.mk41
-rw-r--r--Source/WebKit/android/benchmark/Intercept.cpp190
-rw-r--r--Source/WebKit/android/benchmark/Intercept.h82
-rw-r--r--Source/WebKit/android/benchmark/MyJavaVM.cpp130
-rw-r--r--Source/WebKit/android/benchmark/MyJavaVM.h34
-rw-r--r--Source/WebKit/android/benchmark/main.cpp65
-rw-r--r--Source/WebKit/android/jni/WebCoreJniOnLoad.cpp159
9 files changed, 0 insertions, 707 deletions
diff --git a/Android.mk b/Android.mk
index 7196ce6..651b6db 100644
--- a/Android.mk
+++ b/Android.mk
@@ -390,8 +390,5 @@ include $(BUILD_SHARED_LIBRARY)
# Build the wds client
include $(WEBKIT_PATH)/android/wds/client/Android.mk
-# Build the performance command line tool.
-include $(WEBKIT_PATH)/android/benchmark/Android.mk
-
# Build the webkit merge tool.
include $(BASE_PATH)/Tools/android/webkitmerge/Android.mk
diff --git a/Source/WebKit/Android.mk b/Source/WebKit/Android.mk
index ee7f3ce..a6f17b3 100644
--- a/Source/WebKit/Android.mk
+++ b/Source/WebKit/Android.mk
@@ -52,9 +52,6 @@ LOCAL_SRC_FILES += \
android/RenderSkinMediaButton.cpp \
android/RenderSkinNinePatch.cpp \
\
- android/benchmark/Intercept.cpp \
- android/benchmark/MyJavaVM.cpp \
- \
android/icu/unicode/ucnv.cpp \
\
android/jni/AndroidHitTestResult.cpp \
diff --git a/Source/WebKit/android/benchmark/Android.mk b/Source/WebKit/android/benchmark/Android.mk
deleted file mode 100644
index 5b189e1..0000000
--- a/Source/WebKit/android/benchmark/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-##
-##
-## Copyright 2009, The Android Open Source Project
-##
-## 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.
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 APPLE COMPUTER, INC. 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.
-##
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- main.cpp
-
-# Pull the webkit definitions from the base webkit makefile.
-LOCAL_SHARED_LIBRARIES := libwebcore $(WEBKIT_SHARED_LIBRARIES)
-LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
-
-LOCAL_MODULE := webcore_test
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_EXECUTABLE)
diff --git a/Source/WebKit/android/benchmark/Intercept.cpp b/Source/WebKit/android/benchmark/Intercept.cpp
deleted file mode 100644
index 28ada5a..0000000
--- a/Source/WebKit/android/benchmark/Intercept.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 APPLE COMPUTER, INC. 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.
- */
-
-#define LOG_TAG "webcore_test"
-#include "config.h"
-
-#include "Base64.h"
-#include "HTTPParsers.h"
-#include "Intercept.h"
-#include "ResourceHandle.h"
-#include "ResourceHandleClient.h"
-#include "ResourceRequest.h"
-#include "ResourceResponse.h"
-#include "TextEncoding.h"
-
-#include <utils/Log.h>
-#include <wtf/HashMap.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/StringHash.h>
-
-PassRefPtr<WebCore::ResourceLoaderAndroid> MyResourceLoader::create(
- ResourceHandle* handle, String url)
-{
- return adoptRef<WebCore::ResourceLoaderAndroid>(
- new MyResourceLoader(handle, url));
-}
-
-void MyResourceLoader::handleRequest()
-{
- if (protocolIs(m_url, "data"))
- loadData(m_url.substring(5)); // 5 for data:
- else if (protocolIs(m_url, "file"))
- loadFile(m_url.substring(7)); // 7 for file://
-}
-
-void MyResourceLoader::loadData(const String& data)
-{
- ALOGD("Loading data (%s) ...", data.latin1().data());
- ResourceHandleClient* client = m_handle->client();
- int index = data.find(',');
- if (index == -1) {
- client->cannotShowURL(m_handle);
- return;
- }
-
- String mediaType = data.substring(0, index);
- String base64 = data.substring(index + 1);
-
- bool decode = mediaType.endsWith(";base64", false);
- if (decode)
- mediaType = mediaType.left(mediaType.length() - 7); // 7 for base64;
-
- if (mediaType.isEmpty())
- mediaType = "text/plain;charset=US-ASCII";
-
- String mimeType = extractMIMETypeFromMediaType(mediaType);
- String charset = extractCharsetFromMediaType(mediaType);
-
- ResourceResponse response;
- response.setMimeType(mimeType);
-
- if (decode) {
- base64 = decodeURLEscapeSequences(base64);
- response.setTextEncodingName(charset);
- client->didReceiveResponse(m_handle, response);
-
- // FIXME: This is annoying. WebCore's Base64 decoder chokes on spaces.
- // That is correct with strict decoding but html authors (particularly
- // the acid3 authors) put spaces in the data which should be ignored.
- // Remove them here before sending to the decoder.
- Vector<char> in;
- CString str = base64.latin1();
- const char* chars = str.data();
- unsigned i = 0;
- while (i < str.length()) {
- char c = chars[i];
- // Don't send spaces or control characters.
- if (c != ' ' && c != '\n' && c != '\t' && c != '\b'
- && c != '\f' && c != '\r')
- in.append(chars[i]);
- i++;
- }
- Vector<char> out;
- if (base64Decode(in, out) && out.size() > 0)
- client->didReceiveData(m_handle, out.data(), out.size(), 0);
- } else {
- base64 = decodeURLEscapeSequences(base64, TextEncoding(charset));
- response.setTextEncodingName("UTF-16");
- client->didReceiveResponse(m_handle, response);
- if (base64.length() > 0)
- client->didReceiveData(m_handle, (const char*)base64.characters(),
- base64.length() * sizeof(UChar), 0);
- }
- client->didFinishLoading(m_handle, 0);
-}
-static String mimeTypeForExtension(const String& file)
-{
- static HashMap<String, String, CaseFoldingHash> extensionToMime;
- if (extensionToMime.isEmpty()) {
- extensionToMime.set("txt", "text/plain");
- extensionToMime.set("html", "text/html");
- extensionToMime.set("htm", "text/html");
- extensionToMime.set("png", "image/png");
- extensionToMime.set("jpeg", "image/jpeg");
- extensionToMime.set("jpg", "image/jpeg");
- extensionToMime.set("gif", "image/gif");
- extensionToMime.set("ico", "image/x-icon");
- extensionToMime.set("js", "text/javascript");
- }
- int dot = file.reverseFind('.');
- String mime("text/plain");
- if (dot != -1) {
- String ext = file.substring(dot + 1);
- if (extensionToMime.contains(ext))
- mime = extensionToMime.get(ext);
- }
- return mime;
-}
-
-void MyResourceLoader::loadFile(const String& file)
-{
- ALOGD("Loading file (%s) ...", file.latin1().data());
- FILE* f = fopen(file.latin1().data(), "r");
- ResourceHandleClient* client = m_handle->client();
- if (!f) {
- client->didFail(m_handle,
- ResourceError("", -14, file, "Could not open file"));
- } else {
- ResourceResponse response;
- response.setTextEncodingName("utf-8");
- response.setMimeType(mimeTypeForExtension(file));
- client->didReceiveResponse(m_handle, response);
- char buf[512];
- while (true) {
- int res = fread(buf, 1, sizeof(buf), f);
- if (res <= 0)
- break;
- client->didReceiveData(m_handle, buf, res, 0);
- }
- fclose(f);
- client->didFinishLoading(m_handle, 0);
- }
-}
-
-PassRefPtr<WebCore::ResourceLoaderAndroid> MyWebFrame::startLoadingResource(
- ResourceHandle* handle, const ResourceRequest& req, bool ignore,
- bool ignore2)
-{
- RefPtr<WebCore::ResourceLoaderAndroid> loader =
- MyResourceLoader::create(handle, req.url().string());
- m_requests.append(loader);
- if (!m_timer.isActive())
- m_timer.startOneShot(0);
- return loader.release();
-}
-
-void MyWebFrame::timerFired(Timer<MyWebFrame>*)
-{
- ALOGD("Handling requests...");
- Vector<RefPtr<WebCore::ResourceLoaderAndroid> > reqs;
- reqs.swap(m_requests);
- Vector<RefPtr<WebCore::ResourceLoaderAndroid> >::iterator i = reqs.begin();
- Vector<RefPtr<WebCore::ResourceLoaderAndroid> >::iterator end = reqs.end();
- for (; i != end; i++)
- static_cast<MyResourceLoader*>((*i).get())->handleRequest();
-
- ALOGD("...done");
-}
diff --git a/Source/WebKit/android/benchmark/Intercept.h b/Source/WebKit/android/benchmark/Intercept.h
deleted file mode 100644
index 6694dba..0000000
--- a/Source/WebKit/android/benchmark/Intercept.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 APPLE COMPUTER, INC. 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.
- */
-
-#ifndef Intercept_h
-#define Intercept_h
-
-#include "MyJavaVM.h"
-#include "PlatformString.h"
-#include "Timer.h"
-#include "WebCoreFrameBridge.h"
-#include "WebCoreResourceLoader.h"
-#include <JNIUtility.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
- class Page;
- class ResourceHandle;
- class ResourceRequest;
-}
-
-using namespace android;
-using namespace WebCore;
-using namespace WTF;
-
-class MyResourceLoader : public WebCoreResourceLoader {
-public:
- static PassRefPtr<WebCore::ResourceLoaderAndroid> create(
- ResourceHandle* handle, String url);
- void handleRequest();
-
-private:
- MyResourceLoader(ResourceHandle* handle, String url)
- : WebCoreResourceLoader(JSC::Bindings::getJNIEnv(), MY_JOBJECT)
- , m_handle(handle)
- , m_url(url) {}
-
- void loadData(const String&);
- void loadFile(const String&);
- ResourceHandle* m_handle;
- String m_url;
-};
-
-class MyWebFrame : public WebFrame {
-public:
- MyWebFrame(Page* page)
- : WebFrame(JSC::Bindings::getJNIEnv(), MY_JOBJECT, MY_JOBJECT, page)
- , m_timer(this, &MyWebFrame::timerFired) {}
-
- virtual PassRefPtr<WebCore::ResourceLoaderAndroid> startLoadingResource(
- ResourceHandle* handle, const ResourceRequest& req, bool, bool);
-
- virtual bool canHandleRequest(const ResourceRequest&) { return true; }
-
-private:
- void timerFired(Timer<MyWebFrame>*);
- Vector<RefPtr<WebCore::ResourceLoaderAndroid> > m_requests;
- Timer<MyWebFrame> m_timer;
-};
-
-#endif
diff --git a/Source/WebKit/android/benchmark/MyJavaVM.cpp b/Source/WebKit/android/benchmark/MyJavaVM.cpp
deleted file mode 100644
index 574c745..0000000
--- a/Source/WebKit/android/benchmark/MyJavaVM.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 APPLE COMPUTER, INC. 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.
- */
-
-#include "config.h"
-#include "MyJavaVM.h"
-
-#include <JNIUtility.h>
-#include <jni.h>
-
-static JNIEnv* s_env;
-static JavaVM* s_jvm;
-
-// JavaVM functions
-jint vm_attachCurrentThread(JavaVM*, JNIEnv** env, void*) {
- *env = s_env;
- return JNI_OK;
-}
-
-// JNIEnv functions
-jobject env_callObjectMethodV(JNIEnv*, jobject, jmethodID, va_list) {
- return MY_JOBJECT;
-}
-void env_callVoidMethodV(JNIEnv*, jobject, jmethodID, va_list) {}
-void env_deleteRef(JNIEnv*, jobject) {}
-jboolean env_exceptionCheck(JNIEnv*) {
- return false;
-}
-jclass env_findClass(JNIEnv*, const char*) {
- return (jclass) 1;
-}
-jbyte* env_getByteArrayElements(JNIEnv*, jbyteArray, jboolean*) {
- return NULL;
-}
-jmethodID env_getMethodID(JNIEnv*, jclass, const char*, const char*) {
- return (jmethodID) 1;
-}
-jclass env_getObjectClass(JNIEnv*, jobject) {
- return (jclass) 1;
-}
-static const char* s_fakeString = "Fake Java String";
-const jchar* env_getStringChars(JNIEnv*, jstring, jboolean* isCopy) {
- if (isCopy)
- *isCopy = false;
- return (const jchar*)s_fakeString;
-}
-jsize env_getStringLength(JNIEnv*, jstring) {
- return sizeof(s_fakeString) - 1;
-}
-jbyteArray env_newByteArray(JNIEnv*, jsize) {
- return (jbyteArray) 1;
-}
-jobject env_newRef(JNIEnv*, jobject obj) {
- return obj;
-}
-jobject env_newObjectV(JNIEnv*, jclass, jmethodID, va_list) {
- return MY_JOBJECT;
-}
-jstring env_newString(JNIEnv*, const jchar*, jsize) {
- return (jstring) 1;
-}
-void env_releaseByteArrayElements(JNIEnv*, jbyteArray, jbyte*, jint) {}
-void env_releaseStringChars(JNIEnv*, jstring, const jchar*) {}
-void env_setByteArrayRegion(JNIEnv*, jbyteArray, jsize, jsize, const jbyte*) {}
-void env_setIntField(JNIEnv*, jobject, jfieldID, jint) {}
-
-void InitializeJavaVM() {
- // First, create the fake vm
- s_jvm = new JavaVM;
- JNIInvokeInterface* i = new JNIInvokeInterface;
- memset(i, 0, sizeof(JNIInvokeInterface));
- s_jvm->functions = i;
-
- // Now, assign the functions of the vm to our fake ones.
- i->AttachCurrentThread = vm_attachCurrentThread;
-
- // Create the fake env next
- s_env = new JNIEnv;
- JNINativeInterface* n = new JNINativeInterface;
- memset(n, 0, sizeof(JNINativeInterface));
- s_env->functions = n;
-
- // Point the functions we care about to out fake ones.
- n->CallObjectMethodV = env_callObjectMethodV;
- n->CallVoidMethodV = env_callVoidMethodV;
- n->DeleteLocalRef = env_deleteRef;
- n->DeleteGlobalRef = env_deleteRef;
- n->DeleteWeakGlobalRef = env_deleteRef;
- n->ExceptionCheck = env_exceptionCheck;
- n->FindClass = env_findClass;
- n->GetByteArrayElements = env_getByteArrayElements;
- n->GetMethodID = env_getMethodID;
- n->GetObjectClass = env_getObjectClass;
- n->GetStringChars = env_getStringChars;
- n->GetStringLength = env_getStringLength;
- n->NewByteArray = env_newByteArray;
- n->NewLocalRef = env_newRef;
- n->NewGlobalRef = env_newRef;
- n->NewWeakGlobalRef = env_newRef;
- n->NewObjectV = env_newObjectV;
- n->NewString = env_newString;
- n->ReleaseByteArrayElements = env_releaseByteArrayElements;
- n->ReleaseStringChars = env_releaseStringChars;
- n->SetByteArrayRegion = env_setByteArrayRegion;
- n->SetIntField = env_setIntField;
-
- // Tell WebCore about the vm
- JSC::Bindings::setJavaVM(s_jvm);
-}
diff --git a/Source/WebKit/android/benchmark/MyJavaVM.h b/Source/WebKit/android/benchmark/MyJavaVM.h
deleted file mode 100644
index 3092161..0000000
--- a/Source/WebKit/android/benchmark/MyJavaVM.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 APPLE COMPUTER, INC. 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.
- */
-
-#ifndef MyJavaVM_h
-#define MyJavaVM_h
-
-// Make it 1 just to appease any assertions or checks for valid objects
-#define MY_JOBJECT ((jobject) 1)
-
-void InitializeJavaVM();
-
-#endif
diff --git a/Source/WebKit/android/benchmark/main.cpp b/Source/WebKit/android/benchmark/main.cpp
deleted file mode 100644
index 0dcb80b..0000000
--- a/Source/WebKit/android/benchmark/main.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 APPLE COMPUTER, INC. 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.
- */
-
-#define LOG_TAG "webcore_test"
-
-#include <stdlib.h>
-#include <string.h>
-#include <getopt.h>
-#include <utils/Log.h>
-
-namespace android {
-extern void benchmark(const char*, int, int ,int);
-}
-
-int main(int argc, char** argv) {
- int width = 800;
- int height = 600;
- int reloadCount = 0;
- while (true) {
- int c = getopt(argc, argv, "d:r:");
- if (c == -1)
- break;
- else if (c == 'd') {
- char* x = strchr(optarg, 'x');
- if (x) {
- width = atoi(optarg);
- height = atoi(x + 1);
- ALOGD("Rendering page at %dx%d", width, height);
- }
- } else if (c == 'r') {
- reloadCount = atoi(optarg);
- if (reloadCount < 0)
- reloadCount = 0;
- ALOGD("Reloading %d times", reloadCount);
- }
- }
- if (optind >= argc) {
- ALOGE("Please supply a file to read\n");
- return 1;
- }
-
- android::benchmark(argv[optind], reloadCount, width, height);
-}
diff --git a/Source/WebKit/android/jni/WebCoreJniOnLoad.cpp b/Source/WebKit/android/jni/WebCoreJniOnLoad.cpp
index fb959ac..64aeb7e 100644
--- a/Source/WebKit/android/jni/WebCoreJniOnLoad.cpp
+++ b/Source/WebKit/android/jni/WebCoreJniOnLoad.cpp
@@ -62,8 +62,6 @@
#include "WebCoreViewBridge.h"
#include "WebFrameView.h"
#include "WebViewCore.h"
-#include "benchmark/Intercept.h"
-#include "benchmark/MyJavaVM.h"
#include <JNIUtility.h>
#include <jni.h>
@@ -162,160 +160,3 @@ EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved)
return JNI_VERSION_1_4;
}
-
-class MyJavaSharedClient : public TimerClient, public CookieClient {
-public:
- MyJavaSharedClient() : m_hasTimer(false) {}
- virtual void setSharedTimer(long long timemillis) { m_hasTimer = true; }
- virtual void stopSharedTimer() { m_hasTimer = false; }
- virtual void setSharedTimerCallback(void (*f)()) { m_func = f; }
- virtual void signalServiceFuncPtrQueue() {}
-
- // Cookie methods that do nothing.
- virtual void setCookies(const KURL&, const String&) {}
- virtual String cookies(const KURL&) { return ""; }
- virtual bool cookiesEnabled() { return false; }
-
- bool m_hasTimer;
- void (*m_func)();
-};
-
-static void historyItemChanged(HistoryItem* i) {
- if (i->bridge())
- i->bridge()->updateHistoryItem(i);
-}
-
-namespace android {
-
-EXPORT void benchmark(const char* url, int reloadCount, int width, int height) {
- ScriptController::initializeThreading();
-
- // Setting this allows data: urls to load from a local file.
- SecurityOrigin::setLocalLoadPolicy(SecurityOrigin::AllowLocalLoadsForAll);
-
- // Create the fake JNIEnv and JavaVM
- InitializeJavaVM();
-
- // The real function is private to libwebcore but we know what it does.
- notifyHistoryItemChanged = historyItemChanged;
-
- // Implement the shared timer callback
- MyJavaSharedClient client;
- JavaSharedClient::SetTimerClient(&client);
- JavaSharedClient::SetCookieClient(&client);
-
- // Create the page with all the various clients
- ChromeClientAndroid* chrome = new ChromeClientAndroid;
- EditorClientAndroid* editor = new EditorClientAndroid;
- DeviceMotionClientAndroid* deviceMotion = new DeviceMotionClientAndroid;
- DeviceOrientationClientAndroid* deviceOrientation = new DeviceOrientationClientAndroid;
- WebCore::Page::PageClients pageClients;
- pageClients.chromeClient = chrome;
- pageClients.contextMenuClient = new ContextMenuClientAndroid;
- pageClients.editorClient = editor;
- pageClients.dragClient = new DragClientAndroid;
- pageClients.inspectorClient = new InspectorClientAndroid;
- pageClients.deviceMotionClient = deviceMotion;
- pageClients.deviceOrientationClient = deviceOrientation;
- WebCore::Page* page = new WebCore::Page(pageClients);
- editor->setPage(page);
-
- // Create MyWebFrame that intercepts network requests
- MyWebFrame* webFrame = new MyWebFrame(page);
- webFrame->setUserAgent("Performance testing"); // needs to be non-empty
- chrome->setWebFrame(webFrame);
- // ChromeClientAndroid maintains the reference.
- Release(webFrame);
-
- // Create the Frame and the FrameLoaderClient
- FrameLoaderClientAndroid* loader = new FrameLoaderClientAndroid(webFrame);
- RefPtr<Frame> frame = Frame::create(page, NULL, loader);
- loader->setFrame(frame.get());
-
- // Build our View system, resize it to the given dimensions and release our
- // references. Note: We keep a referenec to frameView so we can layout and
- // draw later without risk of it being deleted.
- WebViewCore* webViewCore = new WebViewCore(JSC::Bindings::getJNIEnv(),
- MY_JOBJECT, frame.get());
- RefPtr<FrameView> frameView = FrameView::create(frame.get());
- WebFrameView* webFrameView = new WebFrameView(frameView.get(), webViewCore);
- frame->setView(frameView);
- frameView->resize(width, height);
- Release(webViewCore);
- Release(webFrameView);
-
- // Initialize the frame and turn of low-bandwidth display (it fails an
- // assertion in the Cache code)
- frame->init();
- frame->selection()->setFocused(true);
- frame->page()->focusController()->setFocused(true);
-
- deviceMotion->setWebViewCore(webViewCore);
- deviceOrientation->setWebViewCore(webViewCore);
-
- // Set all the default settings the Browser normally uses.
- Settings* s = frame->settings();
-#ifdef ANDROID_LAYOUT
- s->setLayoutAlgorithm(Settings::kLayoutNormal); // Normal layout for now
-#endif
- s->setStandardFontFamily("sans-serif");
- s->setFixedFontFamily("monospace");
- s->setSansSerifFontFamily("sans-serif");
- s->setSerifFontFamily("serif");
- s->setCursiveFontFamily("cursive");
- s->setFantasyFontFamily("fantasy");
- s->setMinimumFontSize(8);
- s->setMinimumLogicalFontSize(8);
- s->setDefaultFontSize(16);
- s->setDefaultFixedFontSize(13);
- s->setLoadsImagesAutomatically(true);
- s->setJavaScriptEnabled(true);
- s->setDefaultTextEncodingName("latin1");
- s->setPluginsEnabled(false);
- s->setShrinksStandaloneImagesToFit(false);
-#ifdef ANDROID_LAYOUT
- s->setUseWideViewport(false);
-#endif
-
- // Finally, load the actual data
- ResourceRequest req(url);
- frame->loader()->load(req, false);
-
- do {
- // Layout the page and service the timer
- frame->view()->layout();
- while (client.m_hasTimer) {
- client.m_func();
- JavaSharedClient::ServiceFunctionPtrQueue();
- }
- JavaSharedClient::ServiceFunctionPtrQueue();
-
- // Layout more if needed.
- while (frame->view()->needsLayout())
- frame->view()->layout();
- JavaSharedClient::ServiceFunctionPtrQueue();
-
- if (reloadCount)
- frame->loader()->reload(true);
- } while (reloadCount--);
-
- // Draw into an offscreen bitmap
- SkBitmap bmp;
- bmp.setConfig(SkBitmap::kARGB_8888_Config, width, height);
- bmp.allocPixels();
- SkCanvas canvas(bmp);
- PlatformGraphicsContext ctx(&canvas);
- GraphicsContext gc(&ctx);
- frame->view()->paintContents(&gc, IntRect(0, 0, width, height));
-
- // Write the bitmap to the sdcard
- SkImageEncoder* enc = SkImageEncoder::Create(SkImageEncoder::kPNG_Type);
- enc->encodeFile("/sdcard/webcore_test.png", bmp, 100);
- delete enc;
-
- // Tear down the world.
- frame->loader()->detachFromParent();
- delete page;
-}
-
-} // namespace android