diff options
author | Patrick Scott <phanna@android.com> | 2009-12-15 15:34:48 -0500 |
---|---|---|
committer | Patrick Scott <phanna@android.com> | 2009-12-15 15:34:48 -0500 |
commit | 802287c282ab2d325404825796b77d0e15a6b053 (patch) | |
tree | a331e6f2a8d4fa613cbd23af508c584f3026f97c /WebKit | |
parent | d4924af12855cd19162ba1442a6055664c98ca32 (diff) | |
download | external_webkit-802287c282ab2d325404825796b77d0e15a6b053.zip external_webkit-802287c282ab2d325404825796b77d0e15a6b053.tar.gz external_webkit-802287c282ab2d325404825796b77d0e15a6b053.tar.bz2 |
Fix the benchmark app yet again to work in mr2 (and master).
The signature of startLoadingResource changed. The PageCache can change the
FrameView so don't use the local one. Add a few more function intercepts in the
fake vm.
Diffstat (limited to 'WebKit')
-rw-r--r-- | WebKit/android/benchmark/Intercept.cpp | 22 | ||||
-rw-r--r-- | WebKit/android/benchmark/Intercept.h | 9 | ||||
-rw-r--r-- | WebKit/android/benchmark/MyJavaVM.cpp | 3 | ||||
-rw-r--r-- | WebKit/android/jni/WebCoreJniOnLoad.cpp | 8 |
4 files changed, 25 insertions, 17 deletions
diff --git a/WebKit/android/benchmark/Intercept.cpp b/WebKit/android/benchmark/Intercept.cpp index d657353..fe8e7bb 100644 --- a/WebKit/android/benchmark/Intercept.cpp +++ b/WebKit/android/benchmark/Intercept.cpp @@ -39,9 +39,11 @@ #include <utils/Log.h> #include <wtf/HashMap.h> -PassRefPtr<MyResourceLoader> MyResourceLoader::create(ResourceHandle* handle, String url) +PassRefPtr<WebCore::ResourceLoaderAndroid> MyResourceLoader::create( + ResourceHandle* handle, String url) { - return adoptRef(new MyResourceLoader(handle, url)); + return adoptRef<WebCore::ResourceLoaderAndroid>( + new MyResourceLoader(handle, url)); } void MyResourceLoader::handleRequest() @@ -161,10 +163,12 @@ void MyResourceLoader::loadFile(const String& file) } } -PassRefPtr<MyResourceLoader> MyWebFrame::startLoadingResource(ResourceHandle* handle, - const ResourceRequest& req, bool ignore) +PassRefPtr<WebCore::ResourceLoaderAndroid> MyWebFrame::startLoadingResource( + ResourceHandle* handle, const ResourceRequest& req, bool ignore, + bool ignore2) { - RefPtr<MyResourceLoader> loader = MyResourceLoader::create(handle, req.url().string()); + RefPtr<WebCore::ResourceLoaderAndroid> loader = + MyResourceLoader::create(handle, req.url().string()); m_requests.append(loader); if (!m_timer.isActive()) m_timer.startOneShot(0); @@ -174,12 +178,12 @@ PassRefPtr<MyResourceLoader> MyWebFrame::startLoadingResource(ResourceHandle* ha void MyWebFrame::timerFired(Timer<MyWebFrame>*) { LOGD("Handling requests..."); - Vector<RefPtr<MyResourceLoader> > reqs; + Vector<RefPtr<WebCore::ResourceLoaderAndroid> > reqs; reqs.swap(m_requests); - Vector<RefPtr<MyResourceLoader> >::iterator i = reqs.begin(); - Vector<RefPtr<MyResourceLoader> >::iterator end = reqs.end(); + Vector<RefPtr<WebCore::ResourceLoaderAndroid> >::iterator i = reqs.begin(); + Vector<RefPtr<WebCore::ResourceLoaderAndroid> >::iterator end = reqs.end(); for (; i != end; i++) - (*i)->handleRequest(); + static_cast<MyResourceLoader*>((*i).get())->handleRequest(); LOGD("...done"); } diff --git a/WebKit/android/benchmark/Intercept.h b/WebKit/android/benchmark/Intercept.h index 6981e51..fbf38bc 100644 --- a/WebKit/android/benchmark/Intercept.h +++ b/WebKit/android/benchmark/Intercept.h @@ -46,7 +46,8 @@ using namespace WTF; class MyResourceLoader : public WebCoreResourceLoader { public: - static PassRefPtr<MyResourceLoader> create(ResourceHandle* handle, String url); + static PassRefPtr<WebCore::ResourceLoaderAndroid> create( + ResourceHandle* handle, String url); void handleRequest(); private: @@ -67,14 +68,14 @@ public: : WebFrame(JSC::Bindings::getJNIEnv(), MY_JOBJECT, MY_JOBJECT, page) , m_timer(this, &MyWebFrame::timerFired) {} - virtual PassRefPtr<MyResourceLoader> startLoadingResource(ResourceHandle* handle, - const ResourceRequest& req, bool); + 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<MyResourceLoader> > m_requests; + Vector<RefPtr<WebCore::ResourceLoaderAndroid> > m_requests; Timer<MyWebFrame> m_timer; }; diff --git a/WebKit/android/benchmark/MyJavaVM.cpp b/WebKit/android/benchmark/MyJavaVM.cpp index 82eea2a..f73a3ea 100644 --- a/WebKit/android/benchmark/MyJavaVM.cpp +++ b/WebKit/android/benchmark/MyJavaVM.cpp @@ -107,6 +107,7 @@ void InitializeJavaVM() { 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; @@ -115,7 +116,9 @@ void InitializeJavaVM() { 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; diff --git a/WebKit/android/jni/WebCoreJniOnLoad.cpp b/WebKit/android/jni/WebCoreJniOnLoad.cpp index 616526b..f02e92a 100644 --- a/WebKit/android/jni/WebCoreJniOnLoad.cpp +++ b/WebKit/android/jni/WebCoreJniOnLoad.cpp @@ -250,7 +250,7 @@ EXPORT void benchmark(const char* url, int reloadCount, int width, int height) { do { // Layout the page and service the timer - frameView->layout(); + frame->view()->layout(); while (client.m_hasTimer) { client.m_func(); JavaSharedClient::ServiceFunctionPtrQueue(); @@ -258,8 +258,8 @@ EXPORT void benchmark(const char* url, int reloadCount, int width, int height) { JavaSharedClient::ServiceFunctionPtrQueue(); // Layout more if needed. - while (frameView->needsLayout()) - frameView->layout(); + while (frame->view()->needsLayout()) + frame->view()->layout(); JavaSharedClient::ServiceFunctionPtrQueue(); if (reloadCount) @@ -273,7 +273,7 @@ EXPORT void benchmark(const char* url, int reloadCount, int width, int height) { SkCanvas canvas(bmp); PlatformGraphicsContext ctx(&canvas, NULL); GraphicsContext gc(&ctx); - frameView->paintContents(&gc, IntRect(0, 0, width, height)); + frame->view()->paintContents(&gc, IntRect(0, 0, width, height)); // Write the bitmap to the sdcard SkImageEncoder* enc = SkImageEncoder::Create(SkImageEncoder::kPNG_Type); |