summaryrefslogtreecommitdiffstats
path: root/WebCore/plugins
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-02-15 12:23:52 +0000
committerSteve Block <steveblock@google.com>2010-02-16 11:48:32 +0000
commit8a0914b749bbe7da7768e07a7db5c6d4bb09472b (patch)
tree73f9065f370435d6fde32ae129d458a8c77c8dff /WebCore/plugins
parentbf14be70295513b8076f3fa47a268a7e42b2c478 (diff)
downloadexternal_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.zip
external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.tar.gz
external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.tar.bz2
Merge webkit.org at r54731 : Initial merge by git
Change-Id: Ia79977b6cf3b0b00c06ef39419989b28e57e4f4a
Diffstat (limited to 'WebCore/plugins')
-rw-r--r--WebCore/plugins/PluginStream.cpp6
-rw-r--r--WebCore/plugins/PluginView.cpp51
-rw-r--r--WebCore/plugins/PluginView.h14
-rw-r--r--WebCore/plugins/PluginViewNone.cpp6
-rw-r--r--WebCore/plugins/gtk/PluginViewGtk.cpp10
-rw-r--r--WebCore/plugins/win/PluginViewWin.cpp4
6 files changed, 73 insertions, 18 deletions
diff --git a/WebCore/plugins/PluginStream.cpp b/WebCore/plugins/PluginStream.cpp
index 4be3d13..bf35ba4 100644
--- a/WebCore/plugins/PluginStream.cpp
+++ b/WebCore/plugins/PluginStream.cpp
@@ -84,7 +84,7 @@ PluginStream::~PluginStream()
ASSERT(m_streamState != StreamStarted);
ASSERT(!m_loader);
- free((char*)m_stream.url);
+ fastFree((char*)m_stream.url);
streams().remove(&m_stream);
}
@@ -133,9 +133,9 @@ void PluginStream::startStream()
// Some plugins (Flash) expect that javascript URLs are passed back decoded as this is the
// format used when requesting the URL.
if (protocolIsJavaScript(responseURL))
- m_stream.url = strdup(decodeURLEscapeSequences(responseURL.string()).utf8().data());
+ m_stream.url = fastStrDup(decodeURLEscapeSequences(responseURL.string()).utf8().data());
else
- m_stream.url = strdup(responseURL.string().utf8().data());
+ m_stream.url = fastStrDup(responseURL.string().utf8().data());
CString mimeTypeStr = m_resourceResponse.mimeType().utf8();
diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp
index d763219..a0ae79f 100644
--- a/WebCore/plugins/PluginView.cpp
+++ b/WebCore/plugins/PluginView.cpp
@@ -95,6 +95,14 @@ using namespace HTMLNames;
static int s_callingPlugin;
+typedef HashMap<NPP, PluginView*> InstanceMap;
+
+static InstanceMap& instanceMap()
+{
+ static InstanceMap& map = *new InstanceMap;
+ return map;
+}
+
static String scriptStringIfJavaScriptURL(const KURL& url)
{
if (!protocolIsJavaScript(url))
@@ -210,7 +218,10 @@ bool PluginView::startOrAddToUnstartedList()
if (!m_parentFrame->page())
return false;
- if (!m_parentFrame->page()->canStartPlugins()) {
+ // We only delay starting the plug-in if we're going to kick off the load
+ // ourselves. Otherwise, the loader will try to deliver data before we've
+ // started the plug-in.
+ if (!m_loadManually && !m_parentFrame->page()->canStartPlugins()) {
m_parentFrame->page()->addUnstartedPlugin(this);
m_isWaitingToStart = true;
return true;
@@ -278,6 +289,10 @@ PluginView::~PluginView()
{
LOG(Plugins, "PluginView::~PluginView()");
+ ASSERT(!m_lifeSupportTimer.isActive());
+
+ instanceMap().remove(m_instance);
+
removeFromUnstartedListIfNecessary();
stop();
@@ -451,7 +466,7 @@ void PluginView::performRequest(PluginRequest* request)
// if this is not a targeted request, create a stream for it. otherwise,
// just pass it off to the loader
if (targetFrameName.isEmpty()) {
- RefPtr<PluginStream> stream = PluginStream::create(this, m_parentFrame, request->frameLoadRequest().resourceRequest(), request->sendNotification(), request->notifyData(), plugin()->pluginFuncs(), instance(), m_plugin->quirks());
+ RefPtr<PluginStream> stream = PluginStream::create(this, m_parentFrame.get(), request->frameLoadRequest().resourceRequest(), request->sendNotification(), request->notifyData(), plugin()->pluginFuncs(), instance(), m_plugin->quirks());
m_streams.add(stream);
stream->start();
} else {
@@ -492,7 +507,7 @@ void PluginView::performRequest(PluginRequest* request)
if (getString(parentFrame->script(), result, resultString))
cstr = resultString.utf8();
- RefPtr<PluginStream> stream = PluginStream::create(this, m_parentFrame, request->frameLoadRequest().resourceRequest(), request->sendNotification(), request->notifyData(), plugin()->pluginFuncs(), instance(), m_plugin->quirks());
+ RefPtr<PluginStream> stream = PluginStream::create(this, m_parentFrame.get(), request->frameLoadRequest().resourceRequest(), request->sendNotification(), request->notifyData(), plugin()->pluginFuncs(), instance(), m_plugin->quirks());
m_streams.add(stream);
stream->sendJavaScriptStream(requestURL, cstr);
}
@@ -632,7 +647,7 @@ NPError PluginView::destroyStream(NPStream* stream, NPReason reason)
void PluginView::status(const char* message)
{
if (Page* page = m_parentFrame->page())
- page->chrome()->setStatusbarText(m_parentFrame, String(message));
+ page->chrome()->setStatusbarText(m_parentFrame.get(), String(message));
}
NPError PluginView::setValue(NPPVariable variable, void* value)
@@ -860,6 +875,7 @@ PluginView::PluginView(Frame* parentFrame, const IntSize& size, PluginPackage* p
, m_requestTimer(this, &PluginView::requestTimerFired)
, m_invalidateTimer(this, &PluginView::invalidateTimerFired)
, m_popPopupsStateTimer(this, &PluginView::popPopupsStateTimerFired)
+ , m_lifeSupportTimer(this, &PluginView::lifeSupportTimerFired)
, m_mode(loadManually ? NP_FULL : NP_EMBED)
, m_paramNames(0)
, m_paramValues(0)
@@ -917,6 +933,8 @@ PluginView::PluginView(Frame* parentFrame, const IntSize& size, PluginPackage* p
m_instance->ndata = this;
m_instance->pdata = 0;
+ instanceMap().add(m_instance, this);
+
setParameters(paramNames, paramValues);
memset(&m_npWindow, 0, sizeof(m_npWindow));
@@ -943,7 +961,7 @@ void PluginView::didReceiveResponse(const ResourceResponse& response)
ASSERT(m_loadManually);
ASSERT(!m_manualStream);
- m_manualStream = PluginStream::create(this, m_parentFrame, m_parentFrame->loader()->activeDocumentLoader()->request(), false, 0, plugin()->pluginFuncs(), instance(), m_plugin->quirks());
+ m_manualStream = PluginStream::create(this, m_parentFrame.get(), m_parentFrame->loader()->activeDocumentLoader()->request(), false, 0, plugin()->pluginFuncs(), instance(), m_plugin->quirks());
m_manualStream->setLoadManually(true);
m_manualStream->didReceiveResponse(0, response);
@@ -1336,4 +1354,27 @@ String PluginView::pluginName() const
return m_plugin->name();
}
+void PluginView::lifeSupportTimerFired(Timer<PluginView>*)
+{
+ deref();
+}
+
+void PluginView::keepAlive()
+{
+ if (m_lifeSupportTimer.isActive())
+ return;
+
+ ref();
+ m_lifeSupportTimer.startOneShot(0);
+}
+
+void PluginView::keepAlive(NPP instance)
+{
+ PluginView* view = instanceMap().get(instance);
+ if (!view)
+ return;
+
+ view->keepAlive();
+}
+
} // namespace WebCore
diff --git a/WebCore/plugins/PluginView.h b/WebCore/plugins/PluginView.h
index 48c8ff1..093ca5a 100644
--- a/WebCore/plugins/PluginView.h
+++ b/WebCore/plugins/PluginView.h
@@ -204,7 +204,7 @@ namespace WebCore {
virtual bool isPluginView() const { return true; }
- Frame* parentFrame() const { return m_parentFrame; }
+ Frame* parentFrame() const { return m_parentFrame.get(); }
void focusPluginElement();
@@ -242,6 +242,9 @@ namespace WebCore {
bool start();
+ static void keepAlive(NPP);
+ void keepAlive();
+
private:
PluginView(Frame* parentFrame, const IntSize&, PluginPackage*, Element*, const KURL&, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually);
@@ -267,7 +270,7 @@ namespace WebCore {
static BOOL WINAPI hookedEndPaint(HWND, const PAINTSTRUCT*);
#endif
- Frame* m_parentFrame;
+ RefPtr<Frame> m_parentFrame;
RefPtr<PluginPackage> m_plugin;
Element* m_element;
bool m_isStarted;
@@ -286,6 +289,9 @@ namespace WebCore {
void popPopupsStateTimerFired(Timer<PluginView>*);
Timer<PluginView> m_popPopupsStateTimer;
+ void lifeSupportTimerFired(Timer<PluginView>*);
+ Timer<PluginView> m_lifeSupportTimer;
+
#ifndef NP_NO_CARBON
bool dispatchNPEvent(NPEvent&);
#endif
@@ -376,7 +382,11 @@ public:
private:
+<<<<<<< HEAD
#if defined(XP_UNIX) || PLATFORM(SYMBIAN) || defined(ANDROID_PLUGINS)
+=======
+#if defined(XP_UNIX) || OS(SYMBIAN)
+>>>>>>> webkit.org at r54731
void setNPWindowIfNeeded();
#elif defined(XP_MACOSX)
NP_CGContext m_npCgContext;
diff --git a/WebCore/plugins/PluginViewNone.cpp b/WebCore/plugins/PluginViewNone.cpp
index 725af82..2821afc 100644
--- a/WebCore/plugins/PluginViewNone.cpp
+++ b/WebCore/plugins/PluginViewNone.cpp
@@ -73,7 +73,7 @@ NPError PluginView::getValue(NPNVariable, void*)
}
#if ENABLE(NETSCAPE_PLUGIN_API)
-NPError PluginView::getValueStatic(NPNVariable variable, void* value)
+NPError PluginView::getValueStatic(NPNVariable, void*)
{
return 0;
}
@@ -120,4 +120,8 @@ void PluginView::restart()
{
}
+void PluginView::keepAlive(NPP)
+{
+}
+
} // namespace WebCore
diff --git a/WebCore/plugins/gtk/PluginViewGtk.cpp b/WebCore/plugins/gtk/PluginViewGtk.cpp
index 8f4b2d5..6d992fb 100644
--- a/WebCore/plugins/gtk/PluginViewGtk.cpp
+++ b/WebCore/plugins/gtk/PluginViewGtk.cpp
@@ -137,7 +137,7 @@ void PluginView::updatePluginWidget()
if (m_drawable)
XFreePixmap(GDK_DISPLAY(), m_drawable);
- m_drawable = XCreatePixmap(GDK_DISPLAY(), getRootWindow(m_parentFrame),
+ m_drawable = XCreatePixmap(GDK_DISPLAY(), getRootWindow(m_parentFrame.get()),
m_windowRect.width(), m_windowRect.height(),
((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth);
XSync(GDK_DISPLAY(), False); // make sure that the server knows about the Drawable
@@ -319,7 +319,7 @@ void PluginView::handleKeyboardEvent(KeyboardEvent* event)
GdkEventKey* gdkEvent = event->keyEvent()->gdkEventKey();
xEvent.type = (event->type() == eventNames().keydownEvent) ? 2 : 3; // KeyPress/Release get unset somewhere
- xEvent.xkey.root = getRootWindow(m_parentFrame);
+ xEvent.xkey.root = getRootWindow(m_parentFrame.get());
xEvent.xkey.subwindow = 0; // we have no child window
xEvent.xkey.time = event->timeStamp();
xEvent.xkey.state = gdkEvent->state; // GdkModifierType mirrors xlib state masks
@@ -445,11 +445,11 @@ void PluginView::handleMouseEvent(MouseEvent* event)
IntPoint postZoomPos = roundedIntPoint(m_element->renderer()->absoluteToLocal(event->absoluteLocation()));
if (event->type() == eventNames().mousedownEvent || event->type() == eventNames().mouseupEvent)
- setXButtonEventSpecificFields(&xEvent, event, postZoomPos, m_parentFrame);
+ setXButtonEventSpecificFields(&xEvent, event, postZoomPos, m_parentFrame.get());
else if (event->type() == eventNames().mousemoveEvent)
- setXMotionEventSpecificFields(&xEvent, event, postZoomPos, m_parentFrame);
+ setXMotionEventSpecificFields(&xEvent, event, postZoomPos, m_parentFrame.get());
else if (event->type() == eventNames().mouseoutEvent || event->type() == eventNames().mouseoverEvent)
- setXCrossingEventSpecificFields(&xEvent, event, postZoomPos, m_parentFrame);
+ setXCrossingEventSpecificFields(&xEvent, event, postZoomPos, m_parentFrame.get());
else
return;
#endif
diff --git a/WebCore/plugins/win/PluginViewWin.cpp b/WebCore/plugins/win/PluginViewWin.cpp
index 2ade663..04fda8e 100644
--- a/WebCore/plugins/win/PluginViewWin.cpp
+++ b/WebCore/plugins/win/PluginViewWin.cpp
@@ -585,9 +585,9 @@ void PluginView::paintWindowedPluginIntoContext(GraphicsContext* context, const
// The plugin expects the DC to be in client coordinates, so we translate
// the DC to make that so.
- TransformationMatrix ctm = context->getCTM();
+ AffineTransform ctm = context->getCTM();
ctm.translate(locationInWindow.x(), locationInWindow.y());
- XFORM transform = static_cast<XFORM>(ctm);
+ XFORM transform = static_cast<XFORM>(ctm.toTransformationMatrix());
SetWorldTransform(hdc, &transform);