summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Popescu <andreip@google.com>2010-01-14 15:33:28 +0000
committerAndrei Popescu <andreip@google.com>2010-01-22 15:03:58 +0000
commitb9ca2665dcffd57d63df89bca0444f1cee8d0fee (patch)
treef4e793c38d4767dba83df34e1f03e36f1a21bfa6
parent281327f5e60fa56769d50a55d9dd6b96f5ea5ffb (diff)
downloadexternal_webkit-b9ca2665dcffd57d63df89bca0444f1cee8d0fee.zip
external_webkit-b9ca2665dcffd57d63df89bca0444f1cee8d0fee.tar.gz
external_webkit-b9ca2665dcffd57d63df89bca0444f1cee8d0fee.tar.bz2
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.
-rw-r--r--WebCore/bindings/v8/ScriptController.cpp18
-rw-r--r--WebCore/bindings/v8/ScriptObject.cpp2
-rw-r--r--WebCore/bindings/v8/WorkerContextExecutionProxy.cpp5
-rw-r--r--WebCore/platform/android/PlatformBridge.h5
-rw-r--r--WebKit/android/WebCoreSupport/PlatformBridge.cpp11
5 files changed, 18 insertions, 23 deletions
diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp
index 5b4dbc2..6ba70d6 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<PluginView*>(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 5f5609c..8d80d34 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 8c66d7b..412fde0 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 a73abab..8b08490 100644
--- a/WebCore/platform/android/PlatformBridge.h
+++ b/WebCore/platform/android/PlatformBridge.h
@@ -31,9 +31,12 @@
#include <wtf/Vector.h>
+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 f36ecf7..995999b 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 <wtf/android/AndroidThreading.h>
#include <wtf/MainThread.h>
@@ -98,6 +100,15 @@ bool PlatformBridge::cookiesEnabled()
return client->cookiesEnabled();
}
+NPObject* PlatformBridge::pluginScriptableObject(Widget* widget)
+{
+ if (!widget->isPluginView())
+ return 0;
+
+ PluginView* pluginView = static_cast<PluginView*>(widget);
+ return pluginView->getNPObject();
+}
+
bool PlatformBridge::isWebViewPaused()
{
return WebViewCore::isPaused();