summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-12-18 15:05:48 +0000
committerSteve Block <steveblock@google.com>2009-12-18 15:22:34 +0000
commite1131afba9067af45300e6343a757305051dfb5e (patch)
tree4ff68d96254ef30d1b418eca604bc00ccdc5d7f8 /WebKit
parent485577bbca8667339b88793a02f9a4400b477dd0 (diff)
parenta0fb8e9960b7e264253886f20f214cdade1eb1e4 (diff)
downloadexternal_webkit-e1131afba9067af45300e6343a757305051dfb5e.zip
external_webkit-e1131afba9067af45300e6343a757305051dfb5e.tar.gz
external_webkit-e1131afba9067af45300e6343a757305051dfb5e.tar.bz2
resolved conflicts for merge of a0fb8e99 to master
Change-Id: I58d6bb71dc7c4f5962c73669555a217c1d94b690
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.cpp89
1 files changed, 47 insertions, 42 deletions
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp
index bbc288a..ad32eb4 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -116,6 +116,8 @@
#include "TimeCounter.h"
#endif
+using namespace JSC::Bindings;
+
static String* gUploadFileLabel;
static String* gResetLabel;
static String* gSubmitLabel;
@@ -278,7 +280,7 @@ WebFrame::WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page*
WebFrame::~WebFrame()
{
if (mJavaFrame->mObj) {
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
env->DeleteWeakGlobalRef(mJavaFrame->mObj);
env->DeleteWeakGlobalRef(mJavaFrame->mHistoryList);
mJavaFrame->mObj = 0;
@@ -378,7 +380,7 @@ WebFrame::startLoadingResource(WebCore::ResourceHandle* loader,
WebCore::String method = request.httpMethod();
WebCore::HTTPHeaderMap headers = request.httpHeaderFields();
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
WebCore::String urlStr = request.url().string();
int colon = urlStr.find(':');
bool allLower = true;
@@ -509,7 +511,7 @@ WebFrame::reportError(int errorCode, const WebCore::String& description,
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
LOGV("::WebCore:: reportError(%d, %s)", errorCode, description.ascii().data());
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
jstring descStr = env->NewString((unsigned short*)description.characters(), description.length());
jstring failUrl = env->NewString((unsigned short*)failingUrl.characters(), failingUrl.length());
@@ -539,7 +541,7 @@ WebFrame::loadStarted(WebCore::Frame* frame)
!isMainFrame))
return;
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
WebCore::String urlString(url.string());
// If this is the main frame and we already have a favicon in the database,
// send it along with the page started notification.
@@ -576,7 +578,7 @@ WebFrame::transitionToCommitted(WebCore::Frame* frame)
#ifdef ANDROID_INSTRUMENT
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
WebCore::FrameLoadType loadType = frame->loader()->loadType();
bool isMainFrame = (!frame->tree() || !frame->tree()->parent());
env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mTransitionToCommitted,
@@ -590,7 +592,7 @@ WebFrame::didFinishLoad(WebCore::Frame* frame)
#ifdef ANDROID_INSTRUMENT
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
WebCore::FrameLoader* loader = frame->loader();
const WebCore::KURL& url = loader->activeDocumentLoader()->url();
if (url.isEmpty())
@@ -614,7 +616,7 @@ WebFrame::addHistoryItem(WebCore::HistoryItem* item)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
LOGV("::WebCore:: addHistoryItem");
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
WebHistory::AddItem(mJavaFrame->history(env), item);
}
@@ -625,7 +627,7 @@ WebFrame::removeHistoryItem(int index)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
LOGV("::WebCore:: removeHistoryItem at %d", index);
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
WebHistory::RemoveItem(mJavaFrame->history(env), index);
}
@@ -636,7 +638,7 @@ WebFrame::updateHistoryIndex(int newIndex)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
LOGV("::WebCore:: updateHistoryIndex to %d", newIndex);
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
WebHistory::UpdateHistoryIndex(mJavaFrame->history(env), newIndex);
}
@@ -649,7 +651,7 @@ WebFrame::setTitle(const WebCore::String& title)
#ifndef NDEBUG
LOGV("setTitle(%s)", title.ascii().data());
#endif
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
jstring jTitleStr = env->NewString((unsigned short *)title.characters(), title.length());
env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mSetTitle,
@@ -665,7 +667,7 @@ WebFrame::windowObjectCleared(WebCore::Frame* frame)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
LOGV("::WebCore:: windowObjectCleared");
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mWindowObjectCleared, (int)frame);
checkException(env);
@@ -677,7 +679,7 @@ WebFrame::setProgress(float newProgress)
#ifdef ANDROID_INSTRUMENT
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
int progress = (int) (100 * newProgress);
env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mSetProgress, progress);
checkException(env);
@@ -696,7 +698,7 @@ WebFrame::didReceiveIcon(WebCore::Image* icon)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
LOG_ASSERT(icon, "DidReceiveIcon called without an image!");
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
jobject bitmap = webcoreImageToJavaBitmap(env, icon);
if (!bitmap)
return;
@@ -712,7 +714,7 @@ WebFrame::didReceiveTouchIconURL(const WebCore::String& url, bool precomposed)
#ifdef ANDROID_INSTRUMENT
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
jstring jUrlStr = env->NewString((unsigned short*)url.characters(),
url.length());
@@ -728,7 +730,7 @@ WebFrame::updateVisitedHistory(const WebCore::KURL& url, bool reload)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
WebCore::String urlStr(url.string());
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
jstring jUrlStr = env->NewString((unsigned short*)urlStr.characters(), urlStr.length());
env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mUpdateVisitedHistory, jUrlStr, reload);
@@ -754,7 +756,7 @@ WebFrame::canHandleRequest(const WebCore::ResourceRequest& request)
// Empty urls should not be sent to java
if (url.isEmpty())
return true;
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
// check to see whether browser app wants to hijack url loading.
@@ -770,7 +772,7 @@ WebFrame::createWindow(bool dialog, bool userGesture)
#ifdef ANDROID_INSTRUMENT
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
jobject obj = env->CallObjectMethod(mJavaFrame->frame(env).get(),
mJavaFrame->mCreateWindow, dialog, userGesture);
if (obj) {
@@ -786,7 +788,7 @@ WebFrame::requestFocus() const
#ifdef ANDROID_INSTRUMENT
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mRequestFocus);
checkException(env);
}
@@ -798,7 +800,7 @@ WebFrame::closeWindow(WebViewCore* webViewCore)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
assert(webViewCore);
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mCloseWindow,
webViewCore->getJavaObject().get());
}
@@ -813,7 +815,7 @@ WebFrame::decidePolicyForFormResubmission(WebCore::FramePolicyFunction func)
#ifdef ANDROID_INSTRUMENT
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
PolicyFunctionWrapper* p = new PolicyFunctionWrapper;
p->func = func;
env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mDecidePolicyForFormResubmission, p);
@@ -822,7 +824,7 @@ WebFrame::decidePolicyForFormResubmission(WebCore::FramePolicyFunction func)
WebCore::String
WebFrame::getRawResourceFilename(WebCore::PlatformBridge::rawResId id) const
{
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
jstring ret = (jstring) env->CallObjectMethod(mJavaFrame->frame(env).get(),
mJavaFrame->mGetRawResFilename, (int)id);
@@ -832,7 +834,7 @@ WebFrame::getRawResourceFilename(WebCore::PlatformBridge::rawResId id) const
float
WebFrame::density() const
{
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
jfloat dpi = env->CallFloatMethod(mJavaFrame->frame(env).get(), mJavaFrame->mDensity);
checkException(env);
return dpi;
@@ -1143,25 +1145,26 @@ static jobject StringByEvaluatingJavaScriptFromString(JNIEnv *env, jobject obj,
// Wrap the JavaInstance used when binding custom javascript interfaces. Use a
// weak reference so that the gc can collect the WebView. Override virtualBegin
// and virtualEnd and swap the weak reference for the real object.
-class WeakJavaInstance : public JSC::Bindings::JavaInstance {
+class WeakJavaInstance : public JavaInstance {
public:
- static PassRefPtr<WeakJavaInstance> create(jobject obj,
- PassRefPtr<JSC::Bindings::RootObject> root) {
+ static PassRefPtr<WeakJavaInstance> create(jobject obj, PassRefPtr<RootObject> root)
+ {
return adoptRef(new WeakJavaInstance(obj, root));
}
protected:
- WeakJavaInstance(jobject instance, PassRefPtr<JSC::Bindings::RootObject> rootObject)
- : JSC::Bindings::JavaInstance(instance, rootObject)
+ WeakJavaInstance(jobject instance, PassRefPtr<RootObject> rootObject)
+ : JavaInstance(instance, rootObject)
{
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
// JavaInstance creates a global ref to instance in its constructor.
env->DeleteGlobalRef(_instance->instance());
// Set the object to a weak reference.
_instance->setInstance(env->NewWeakGlobalRef(instance));
}
- ~WeakJavaInstance() {
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ ~WeakJavaInstance()
+ {
+ JNIEnv* env = getJNIEnv();
// Store the weak reference so we can delete it later.
jweak weak = _instance->instance();
// The JavaInstance destructor attempts to delete the global ref stored
@@ -1173,9 +1176,10 @@ protected:
env->DeleteWeakGlobalRef(weak);
}
- virtual void virtualBegin() {
+ virtual void virtualBegin()
+ {
_weakRef = _instance->instance();
- JNIEnv* env = JSC::Bindings::getJNIEnv();
+ JNIEnv* env = getJNIEnv();
// This is odd. getRealObject returns an AutoJObject which is used to
// cleanly create and delete a local reference. But, here we need to
// maintain the local reference across calls to virtualBegin() and
@@ -1188,17 +1192,18 @@ protected:
INHERITED::virtualBegin();
}
- virtual void virtualEnd() {
+ virtual void virtualEnd()
+ {
// Call the base class method first to pop the local frame.
INHERITED::virtualEnd();
// Get rid of the local reference to the real object.
- JSC::Bindings::getJNIEnv()->DeleteLocalRef(_realObject);
+ getJNIEnv()->DeleteLocalRef(_realObject);
// Point back to the WeakReference.
_instance->setInstance(_weakRef);
}
private:
- typedef JSC::Bindings::JavaInstance INHERITED;
+ typedef JavaInstance INHERITED;
jobject _realObject;
jweak _weakRef;
};
@@ -1226,17 +1231,17 @@ static void AddJavascriptInterface(JNIEnv *env, jobject obj, jint nativeFramePoi
JSC::JSLock lock(false);
WebCore::JSDOMWindow *window = WebCore::toJSDOMWindow(pFrame, mainThreadNormalWorld());
if (window) {
- JSC::Bindings::RootObject *root = pFrame->script()->bindingRootObject();
- JSC::Bindings::setJavaVM(vm);
+ RootObject *root = pFrame->script()->bindingRootObject();
+ setJavaVM(vm);
// Add the binding to JS environment
JSC::ExecState* exec = window->globalExec();
- JSC::JSObject *addedObject = WeakJavaInstance::create(javascriptObj,
+ JSC::JSObject* addedObject = WeakJavaInstance::create(javascriptObj,
root)->createRuntimeObject(exec);
const jchar* s = env->GetStringChars(interfaceName, NULL);
if (s) {
// Add the binding name to the window's table of child objects.
JSC::PutPropertySlot slot;
- window->put(exec, JSC::Identifier(exec, (const UChar *)s,
+ window->put(exec, JSC::Identifier(exec, (const UChar *)s,
env->GetStringLength(interfaceName)), addedObject, slot);
env->ReleaseStringChars(interfaceName, s);
checkException(env);
@@ -1246,8 +1251,8 @@ static void AddJavascriptInterface(JNIEnv *env, jobject obj, jint nativeFramePoi
#if USE(V8)
if (pFrame) {
- const char* name = JSC::Bindings::getCharactersFromJStringInEnv(env, interfaceName);
- NPObject* obj = JSC::Bindings::JavaInstanceToNPObject(new JSC::Bindings::JavaInstance(javascriptObj));
+ const char* name = getCharactersFromJStringInEnv(env, interfaceName);
+ NPObject* obj = JavaInstanceToNPObject(new JavaInstance(javascriptObj));
pFrame->script()->bindToWindowObject(pFrame, name, obj);
// JavaInstanceToNPObject calls NPN_RetainObject on the
// returned one (see CreateV8ObjectForNPObject in V8NPObject.cpp).
@@ -1261,7 +1266,7 @@ static void AddJavascriptInterface(JNIEnv *env, jobject obj, jint nativeFramePoi
// WebCore/bridge/npruntime.cpp), so the function is implemented there.
// TODO: Combine the two versions of these NPAPI files.
NPN_ReleaseObject(obj);
- JSC::Bindings::releaseCharactersForJString(interfaceName, name);
+ releaseCharactersForJString(interfaceName, name);
}
#endif