diff options
Diffstat (limited to 'perf')
| -rw-r--r-- | perf/Android.mk | 84 | ||||
| -rw-r--r-- | perf/MyJavaVM.cpp | 2 | ||||
| -rw-r--r-- | perf/main.cpp | 71 |
3 files changed, 60 insertions, 97 deletions
diff --git a/perf/Android.mk b/perf/Android.mk index e8baa29..80ed7df 100644 --- a/perf/Android.mk +++ b/perf/Android.mk @@ -32,81 +32,21 @@ LOCAL_SRC_FILES := \ MyJavaVM.cpp \ main.cpp -WEBCORE := external/webkit/WebCore -WEBKIT := external/webkit/WebKit -JSC := external/webkit/JavaScriptCore +# Pull the webkit definitions from the base webkit makefile. +LOCAL_STATIC_LIBRARIES := libwebcore $(WEBKIT_STATIC_LIBRARIES) +LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES) +LOCAL_LDLIBS := $(WEBKIT_LDLIBS) +LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES) +LOCAL_CFLAGS := $(WEBKIT_CFLAGS) -LOCAL_CFLAGS += -include "WebCorePrefixAndroid.h" +LOCAL_MODULE := webcore_test -LOCAL_C_INCLUDES := \ - $(JNI_H_INCLUDE) \ - external/webkit \ - $(WEBCORE) \ - $(WEBCORE)/page \ - $(WEBCORE)/platform \ - $(WEBCORE)/platform/graphics \ - $(WEBCORE)/platform/network \ - $(WEBCORE)/platform/text \ - $(WEBCORE)/rendering \ - $(WEBKIT) \ - $(WEBKIT)/android/stl \ - $(JSC) \ - external/icu4c/common \ - external/libxml2/include \ - external/skia/include/effects \ - external/skia/include/images \ - external/skia/include/ports \ - external/skia/include/utils \ - external/skia/src/ports \ - external/sqlite/dist \ - $(WEBCORE)/bindings/js \ - $(WEBCORE)/bridge \ - $(WEBCORE)/bridge/c \ - $(WEBCORE)/bridge/jni \ - $(WEBCORE)/css \ - $(WEBCORE)/dom \ - $(WEBCORE)/editing \ - $(WEBCORE)/history \ - $(WEBCORE)/html \ - $(WEBCORE)/inspector \ - $(WEBCORE)/loader \ - $(WEBCORE)/loader/appcache \ - $(WEBCORE)/loader/icon \ - $(WEBCORE)/page/android \ - $(WEBCORE)/page/animation \ - $(WEBCORE)/platform/android \ - $(WEBCORE)/platform/graphics/android \ - $(WEBCORE)/platform/graphics/network \ - $(WEBCORE)/platform/image-decoders \ - $(WEBCORE)/platform/network/android \ - $(WEBCORE)/platform/sql \ - $(WEBCORE)/plugins \ - $(WEBCORE)/rendering/style \ - $(WEBCORE)/storage \ - $(WEBCORE)/xml \ - $(WEBKIT)/android \ - $(WEBKIT)/android/jni \ - $(WEBKIT)/android/nav \ - $(WEBKIT)/android/plugins \ - $(WEBKIT)/android/WebCoreSupport \ - $(JSC)/API \ - $(JSC)/VM \ - $(JSC)/debugger \ - $(JSC)/kjs \ - $(JSC)/icu \ - $(JSC)/pcre \ - $(JSC)/profiler \ - $(JSC)/runtime \ - $(JSC)/wtf \ - $(JSC)/wtf/unicode \ - $(JSC)/wtf/unicode/icu \ - $(JSC)/ForwardingHeaders \ - $(call include-path-for, corecg graphics) +# Do this dependency by hand. The reason we have to do this is because the +# headers that this program pulls in are generated during the build of webcore. +# We make all of our object files depend on those files so that they are built +# before we try to compile our sources. +LOCAL_ADDITIONAL_DEPENDENCIES := $(filter %.h, $(WEBKIT_GENERATED_SOURCES)) -LOCAL_SHARED_LIBRARIES := libwebcore - -LOCAL_MODULE:= webcore_test LOCAL_MODULE_TAGS := optional include $(BUILD_EXECUTABLE) - diff --git a/perf/MyJavaVM.cpp b/perf/MyJavaVM.cpp index d536e6f..82eea2a 100644 --- a/perf/MyJavaVM.cpp +++ b/perf/MyJavaVM.cpp @@ -83,6 +83,7 @@ jstring env_newString(JNIEnv*, const jchar*, jsize) { } 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() { @@ -119,6 +120,7 @@ void InitializeJavaVM() { 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 diff --git a/perf/main.cpp b/perf/main.cpp index cb5358d..927f55e 100644 --- a/perf/main.cpp +++ b/perf/main.cpp @@ -39,7 +39,11 @@ #include "FrameView.h" #include "GraphicsContext.h" #include "HistoryItem.h" +#if USE(JSC) #include "InitializeThreading.h" +#elif USE(V8) +#include "V8InitializeThreading.h" +#endif #include "InspectorClientAndroid.h" #include "Intercept.h" #include "IntRect.h" @@ -75,6 +79,7 @@ public: 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 KURL&, const String&) {} @@ -93,26 +98,34 @@ static void historyItemChanged(HistoryItem* i) { int main(int argc, char** argv) { int width = 800; int height = 600; - if (argc <= 1) { - LOGE("Please supply a file to read\n"); - return 1; - } else { - while (true) { - int c = getopt(argc, argv, "d:"); - if (c == -1) - break; - else if (c == 'd') { - char* x = strchr(optarg, 'x'); - if (x) { - width = atoi(optarg); - height = atoi(x + 1); - LOGD("Rendering page at %dx%d", width, height); - } + 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); + LOGD("Rendering page at %dx%d", width, height); } + } else if (c == 'r') { + reloadCount = atoi(optarg); + if (reloadCount < 0) + reloadCount = 0; + LOGD("Reloading %d times", reloadCount); } } - + if (optind >= argc) { + LOGE("Please supply a file to read\n"); + return 1; + } +#if USE(JSC) JSC::initializeThreading(); +#elif USE(V8) + V8::initializeThreading(); +#endif // Setting this allows data: urls to load from a local file. FrameLoader::setLocalLoadPolicy(FrameLoader::AllowLocalLoadsForAll); @@ -163,7 +176,6 @@ int main(int argc, char** argv) { // assertion in the Cache code) frame->init(); frame->selection()->setFocused(true); - frame->loader()->setUseLowBandwidthDisplay(false); // Set all the default settings the Browser normally uses. Settings* s = frame->settings(); @@ -187,16 +199,25 @@ int main(int argc, char** argv) { // Finally, load the actual data ResourceRequest req(argv[optind]); - frame->loader()->load(req); - - // Layout the page and service the timer - frameView->layout(); - while (client.m_hasTimer) - client.m_func(); + frame->loader()->load(req, false); - // Layout more if needed. - while (frameView->needsLayout()) + do { + // Layout the page and service the timer frameView->layout(); + while (client.m_hasTimer) { + client.m_func(); + JavaSharedClient::ServiceFunctionPtrQueue(); + } + JavaSharedClient::ServiceFunctionPtrQueue(); + + // Layout more if needed. + while (frameView->needsLayout()) + frameView->layout(); + JavaSharedClient::ServiceFunctionPtrQueue(); + + if (reloadCount) + frame->loader()->reload(true); + } while (reloadCount--); // Draw into an offscreen bitmap SkBitmap bmp; |
