From 9d5e9234a371d13bf55a779a6257ae5e277bfb1b Mon Sep 17 00:00:00 2001 From: Steve Block Date: Thu, 16 Feb 2012 10:07:32 +0000 Subject: Remove JSC-specific code and V8 guards from Android-specific code Also removes such code from downstream edits to non-Android-specific code. Bug: 5495373 Change-Id: I478824af2e6ff0eff9a43a9534c2a5ee0e99e9f8 --- .../WebCoreSupport/FrameLoaderClientAndroid.h | 6 +-- .../WebKit/android/WebCoreSupport/MemoryUsage.cpp | 4 -- .../android/WebCoreSupport/PlatformBridge.cpp | 4 -- Source/WebKit/android/jni/WebCoreFrameBridge.cpp | 63 +--------------------- Source/WebKit/android/jni/WebSettings.cpp | 2 - Source/WebKit/android/jni/WebViewCore.cpp | 16 ++---- 6 files changed, 7 insertions(+), 88 deletions(-) (limited to 'Source/WebKit/android') diff --git a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h index 2464c58..51b67ba 100644 --- a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h +++ b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h @@ -200,14 +200,12 @@ namespace android { virtual void documentElementAvailable(); virtual void didPerformFirstNavigation() const; -#if USE(V8) - // TODO(benm): Implement + // TODO: Implement virtual void didCreateScriptContextForFrame() { } virtual void didDestroyScriptContextForFrame() { } virtual void didCreateIsolatedScriptContext() { } - virtual bool allowScriptExtension(const String& extensionName, int extensionGroup) { return false; } -#endif + virtual bool allowScriptExtension(const String& extensionName, int extensionGroup) { return false; } virtual void registerForIconNotification(bool listen = true); diff --git a/Source/WebKit/android/WebCoreSupport/MemoryUsage.cpp b/Source/WebKit/android/WebCoreSupport/MemoryUsage.cpp index 32cdebf..592fad3 100644 --- a/Source/WebKit/android/WebCoreSupport/MemoryUsage.cpp +++ b/Source/WebKit/android/WebCoreSupport/MemoryUsage.cpp @@ -29,9 +29,7 @@ #include #include -#if USE(V8) #include -#endif // USE(V8) using namespace WTF; @@ -59,12 +57,10 @@ int MemoryUsageCache::getCachedMemoryUsage(bool forceFresh) struct mallinfo minfo = mallinfo(); m_cachedMemoryUsage = (minfo.hblkhd + minfo.arena) >> 20; -#if USE(V8) v8::HeapStatistics stat; v8::V8::GetHeapStatistics(&stat); unsigned v8Usage = stat.total_heap_size() >> 20; m_cachedMemoryUsage += v8Usage; -#endif // USE(V8) m_cacheTime = currentTimeMS(); return m_cachedMemoryUsage; diff --git a/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp index 27fe208..41c0222 100644 --- a/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp +++ b/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp @@ -118,15 +118,11 @@ bool PlatformBridge::cookiesEnabled(const Document* document) NPObject* PlatformBridge::pluginScriptableObject(Widget* widget) { -#if USE(V8) if (!widget->isPluginView()) return 0; PluginView* pluginView = static_cast(widget); return pluginView->getNPObject(); -#else - return 0; -#endif } bool PlatformBridge::isWebViewPaused(const WebCore::FrameView* frameView) diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp index adacb49..c7db722 100644 --- a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -60,6 +60,8 @@ #include "IconDatabase.h" #include "Image.h" #include "InspectorClientAndroid.h" +#include "JavaNPObjectV8.h" +#include "JavaInstanceJobjectV8.h" #include "KURL.h" #include "Page.h" #include "PageCache.h" @@ -106,18 +108,6 @@ #include #include -#if USE(JSC) -#include "GCController.h" -#include "JSDOMWindow.h" -#include "JavaInstanceJSC.h" -#include -#include -#include -#elif USE(V8) -#include "JavaNPObjectV8.h" -#include "JavaInstanceJobjectV8.h" -#endif // USE(JSC) - #if ENABLE(WEB_AUTOFILL) #include "autofill/WebAutofill.h" #endif @@ -1612,32 +1602,16 @@ 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. -#if USE(JSC) -class WeakJavaInstance : public JavaInstance { -#elif USE(V8) class WeakJavaInstance : public JavaInstanceJobject { -#endif public: -#if USE(JSC) - static PassRefPtr create(jobject obj, PassRefPtr root) - { - return adoptRef(new WeakJavaInstance(obj, root)); - } -#elif USE(V8) static PassRefPtr create(jobject obj) { return adoptRef(new WeakJavaInstance(obj)); } -#endif private: -#if USE(JSC) - WeakJavaInstance(jobject instance, PassRefPtr rootObject) - : JavaInstance(instance, rootObject) -#elif USE(V8) WeakJavaInstance(jobject instance) : JavaInstanceJobject(instance) -#endif , m_beginEndDepth(0) { JNIEnv* env = getJNIEnv(); @@ -1687,11 +1661,7 @@ private: } private: -#if USE(JSC) - typedef JavaInstance INHERITED; -#elif USE(V8) typedef JavaInstanceJobject INHERITED; -#endif jweak m_weakRef; // The current depth of nested calls to virtualBegin and virtualEnd. int m_beginEndDepth; @@ -1711,28 +1681,6 @@ static void AddJavascriptInterface(JNIEnv *env, jobject obj, jint nativeFramePoi env->GetJavaVM(&vm); ALOGV("::WebCore:: addJSInterface: %p", pFrame); -#if USE(JSC) - // Copied from qwebframe.cpp - JSC::JSLock lock(JSC::SilenceAssertionsOnly); - WebCore::JSDOMWindow *window = WebCore::toJSDOMWindow(pFrame, mainThreadNormalWorld()); - if (window) { - RootObject *root = pFrame->script()->bindingRootObject(); - setJavaVM(vm); - // Add the binding to JS environment - JSC::ExecState* exec = window->globalExec(); - 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, - env->GetStringLength(interfaceName)), addedObject, slot); - env->ReleaseStringChars(interfaceName, s); - checkException(env); - } - } -#elif USE(V8) if (pFrame) { RefPtr addedObject = WeakJavaInstance::create(javascriptObj); const char* name = getCharactersFromJStringInEnv(env, interfaceName); @@ -1753,8 +1701,6 @@ static void AddJavascriptInterface(JNIEnv *env, jobject obj, jint nativeFramePoi NPN_ReleaseObject(npObject); releaseCharactersForJString(interfaceName, name); } -#endif - } static void SetCacheDisabled(JNIEnv *env, jobject obj, jboolean disabled) @@ -1798,13 +1744,8 @@ static void ClearCache(JNIEnv *env, jobject obj) { ClearWebCoreCache(); ClearWebViewCache(); -#if USE(JSC) - // force JavaScript to GC when clear cache - WebCore::gcController().garbageCollectSoon(); -#elif USE(V8) WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); pFrame->script()->lowMemoryNotification(); -#endif // USE(JSC) } static jboolean DocumentHasImages(JNIEnv *env, jobject obj) diff --git a/Source/WebKit/android/jni/WebSettings.cpp b/Source/WebKit/android/jni/WebSettings.cpp index 9b6f08b..9f7c2fa 100644 --- a/Source/WebKit/android/jni/WebSettings.cpp +++ b/Source/WebKit/android/jni/WebSettings.cpp @@ -49,9 +49,7 @@ #include "Settings.h" #include "WebCoreFrameBridge.h" #include "WebCoreJni.h" -#if USE(V8) #include "WorkerContextExecutionProxy.h" -#endif #include "WebRequestContext.h" #include "WebViewCore.h" diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index 81bf577..2f177ed 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -104,6 +104,7 @@ #include "ResourceRequest.h" #include "RuntimeEnabledFeatures.h" #include "SchemeRegistry.h" +#include "ScriptController.h" #include "SelectionController.h" #include "SelectText.h" #include "Settings.h" @@ -130,14 +131,11 @@ #include #include #include +#include #include #include -#include - -#if USE(V8) -#include "ScriptController.h" #include -#endif +#include #if DEBUG_NAV_UI #include "SkTime.h" @@ -161,10 +159,6 @@ FILE* gRenderTreeFile = 0; #include "RenderLayerCompositor.h" #endif -#if USE(V8) -#include -#endif - // In some cases, too many invalidations passed to the UI will slow us down. // Limit ourselves to 32 rectangles, past this just send the area bounds to the UI. // see WebViewCore::recordPictureSet(). @@ -465,12 +459,10 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m AndroidNetworkLibraryImpl::InitWithApplicationContext(env, 0); #endif -#if USE(V8) // Static initialisation of certain important V8 static data gets performed at system startup when // libwebcore gets loaded. We now need to associate the WebCore thread with V8 to complete // initialisation. v8::V8::Initialize(); -#endif // Configure any RuntimeEnabled features that we need to change from their default now. // See WebCore/bindings/generic/RuntimeEnabledFeatures.h @@ -4800,11 +4792,9 @@ static void DumpNavTree(JNIEnv* env, jobject obj, jint nativeClass) static void SetJsFlags(JNIEnv* env, jobject obj, jint nativeClass, jstring flags) { -#if USE(V8) WTF::String flagsString = jstringToWtfString(env, flags); WTF::CString utf8String = flagsString.utf8(); WebCore::ScriptController::setFlags(utf8String.data(), utf8String.length()); -#endif } -- cgit v1.1