From b9ca2665dcffd57d63df89bca0444f1cee8d0fee Mon Sep 17 00:00:00 2001 From: Andrei Popescu Date: Thu, 14 Jan 2010 15:33:28 +0000 Subject: [PATCH] Prepare ScriptController class for upstreaming. Move the code to obtain the NPObject ptr associated with a PluginView to the PlatformBridge. This change will be submitted as soon as the patch in https://bugs.webkit.org/show_bug.cgi?id=33673 lands upstream. --- WebCore/bindings/v8/ScriptController.cpp | 18 ++---------------- WebCore/bindings/v8/ScriptObject.cpp | 2 -- WebCore/bindings/v8/WorkerContextExecutionProxy.cpp | 5 ----- WebCore/platform/android/PlatformBridge.h | 5 +++++ WebKit/android/WebCoreSupport/PlatformBridge.cpp | 11 +++++++++++ 5 files changed, 18 insertions(+), 23 deletions(-) diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp index 5b4dbc241..6ba70d6d9 100644 --- a/WebCore/bindings/v8/ScriptController.cpp +++ b/WebCore/bindings/v8/ScriptController.cpp @@ -32,12 +32,8 @@ #include "config.h" #include "ScriptController.h" -#if PLATFORM(CHROMIUM) -#include "ChromiumBridge.h" -#elif PLATFORM(ANDROID) -#include "PluginView.h" -#endif +#include "PlatformBridge.h" #include "CString.h" #include "Document.h" #include "DOMWindow.h" @@ -306,23 +302,13 @@ PassScriptInstance ScriptController::createScriptInstanceForWidget(Widget* widge { ASSERT(widget); -#if PLATFORM(CHROMIUM) if (widget->isFrameView()) return 0; - NPObject* npObject = ChromiumBridge::pluginScriptableObject(widget); - if (!npObject) - return 0; - -#elif PLATFORM(ANDROID) - if (!widget->isPluginView()) - return 0; + NPObject* npObject = PlatformBridge::pluginScriptableObject(widget); - PluginView* pluginView = static_cast(widget); - NPObject* npObject = pluginView->getNPObject(); if (!npObject) return 0; -#endif // Frame Memory Management for NPObjects // ------------------------------------- diff --git a/WebCore/bindings/v8/ScriptObject.cpp b/WebCore/bindings/v8/ScriptObject.cpp index 5f5609c2d..8d80d3444 100644 --- a/WebCore/bindings/v8/ScriptObject.cpp +++ b/WebCore/bindings/v8/ScriptObject.cpp @@ -144,9 +144,7 @@ bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, const S bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InspectorBackend* value) { ScriptScope scope(scriptState); -#if !PLATFORM(ANDROID) scope.global()->Set(v8::String::New(name), V8DOMWrapper::convertToV8Object(V8ClassIndex::INSPECTORBACKEND, value)); -#endif return scope.success(); } diff --git a/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp b/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp index 8c66d7b70..412fde088 100644 --- a/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp +++ b/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp @@ -124,11 +124,6 @@ void WorkerContextExecutionProxy::initV8IfNeeded() v8::V8::IgnoreOutOfMemoryException(); v8::V8::SetFatalErrorHandler(reportFatalErrorInV8); -#if PLATFORM(ANDROID) - const int workerThreadPreemptionIntervalMs = 5; - v8::Locker::StartPreemption(workerThreadPreemptionIntervalMs); -#endif - v8::ResourceConstraints resource_constraints; uint32_t here; resource_constraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uint32_t*)); diff --git a/WebCore/platform/android/PlatformBridge.h b/WebCore/platform/android/PlatformBridge.h index a73abab48..8b0849095 100644 --- a/WebCore/platform/android/PlatformBridge.h +++ b/WebCore/platform/android/PlatformBridge.h @@ -31,9 +31,12 @@ #include +class NPObject; + namespace WebCore { class FrameView; +class Widget; // An interface to the embedding layer, which has the ability to answer // questions about the system and so on... @@ -54,6 +57,8 @@ public: static void setCookies(const KURL&, const String& value); static String cookies(const KURL&); static bool cookiesEnabled(); + // Plugin + static NPObject* pluginScriptableObject(Widget*); // These ids need to be in sync with the constants in BrowserFrame.java enum rawResId { NoDomain = 1, diff --git a/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/WebKit/android/WebCoreSupport/PlatformBridge.cpp index f36ecf761..995999bc6 100644 --- a/WebKit/android/WebCoreSupport/PlatformBridge.cpp +++ b/WebKit/android/WebCoreSupport/PlatformBridge.cpp @@ -29,7 +29,9 @@ #include "CookieClient.h" #include "JavaSharedClient.h" #include "KeyGeneratorClient.h" +#include "PluginView.h" #include "WebViewCore.h" +#include "npruntime.h" #include #include @@ -98,6 +100,15 @@ bool PlatformBridge::cookiesEnabled() return client->cookiesEnabled(); } +NPObject* PlatformBridge::pluginScriptableObject(Widget* widget) +{ + if (!widget->isPluginView()) + return 0; + + PluginView* pluginView = static_cast(widget); + return pluginView->getNPObject(); +} + bool PlatformBridge::isWebViewPaused() { return WebViewCore::isPaused(); -- 2.11.0