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.
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 @@
}
}
-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 @@
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 @@
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 @@
: 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 @@
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 @@
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 @@
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 @@
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 @@
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);