summaryrefslogtreecommitdiffstats
path: root/WebCore
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-03-12 20:46:03 +0000
committerBen Murdoch <benm@google.com>2010-03-22 20:50:51 +0000
commita923424180b9d2cbe3a3951caed13039eef1edf6 (patch)
tree94c79707c7425deaee1f53e35512bd3760e6c8e9 /WebCore
parent343ec940062f940a47d74fc359b661de8be2f3b8 (diff)
downloadexternal_webkit-a923424180b9d2cbe3a3951caed13039eef1edf6.zip
external_webkit-a923424180b9d2cbe3a3951caed13039eef1edf6.tar.gz
external_webkit-a923424180b9d2cbe3a3951caed13039eef1edf6.tar.bz2
Add a new API on the resource loader to pause the current load. We use this when the plugin cannot accept any more data to prevent WebKit
buffering the data that the plugin can't take. This can result in a crash if the buffer gets too big (when watching an HD movie clip in flash, for example). Requires a frameworks/base change. Change-Id: Ibb63d38df1014ff70fa4d65275613cbf3a217c1a
Diffstat (limited to 'WebCore')
-rw-r--r--WebCore/loader/ResourceLoader.cpp9
-rw-r--r--WebCore/loader/ResourceLoader.h4
-rw-r--r--WebCore/platform/network/ResourceHandle.h6
-rw-r--r--WebCore/platform/network/android/ResourceHandleAndroid.cpp9
-rw-r--r--WebCore/platform/network/android/ResourceLoaderAndroid.h3
-rw-r--r--WebCore/plugins/PluginStream.cpp10
6 files changed, 40 insertions, 1 deletions
diff --git a/WebCore/loader/ResourceLoader.cpp b/WebCore/loader/ResourceLoader.cpp
index 95ce209..d14afc8 100644
--- a/WebCore/loader/ResourceLoader.cpp
+++ b/WebCore/loader/ResourceLoader.cpp
@@ -149,6 +149,15 @@ void ResourceLoader::setDefersLoading(bool defers)
}
}
+#if PLATFORM(ANDROID)
+// TODO: This needs upstreaming to WebKit.
+void ResourceLoader::pauseLoad(bool pause)
+{
+ if (m_handle)
+ m_handle->pauseLoad(pause);
+}
+#endif
+
FrameLoader* ResourceLoader::frameLoader() const
{
if (!m_frame)
diff --git a/WebCore/loader/ResourceLoader.h b/WebCore/loader/ResourceLoader.h
index 5239289..3178eb4 100644
--- a/WebCore/loader/ResourceLoader.h
+++ b/WebCore/loader/ResourceLoader.h
@@ -64,6 +64,10 @@ namespace WebCore {
ResourceError cannotShowURLError();
virtual void setDefersLoading(bool);
+#if PLATFORM(ANDROID)
+// TODO: This needs upstreaming to WebKit.
+ virtual void pauseLoad(bool);
+#endif
void setIdentifier(unsigned long identifier) { m_identifier = identifier; }
unsigned long identifier() const { return m_identifier; }
diff --git a/WebCore/platform/network/ResourceHandle.h b/WebCore/platform/network/ResourceHandle.h
index b764add..e340aca 100644
--- a/WebCore/platform/network/ResourceHandle.h
+++ b/WebCore/platform/network/ResourceHandle.h
@@ -189,7 +189,11 @@ public:
void setClient(ResourceHandleClient*);
void setDefersLoading(bool);
-
+#if PLATFORM(ANDROID)
+// TODO: this needs upstreaming.
+ void pauseLoad(bool);
+#endif
+
const ResourceRequest& request() const;
void fireFailure(Timer<ResourceHandle>*);
diff --git a/WebCore/platform/network/android/ResourceHandleAndroid.cpp b/WebCore/platform/network/android/ResourceHandleAndroid.cpp
index 1154b47..6759852 100644
--- a/WebCore/platform/network/android/ResourceHandleAndroid.cpp
+++ b/WebCore/platform/network/android/ResourceHandleAndroid.cpp
@@ -84,6 +84,15 @@ bool ResourceHandle::supportsBufferedData()
return false;
}
+#if PLATFORM(ANDROID)
+// TODO: this needs upstreaming.
+void ResourceHandle::pauseLoad(bool pause)
+{
+ if (d->m_loader)
+ d->m_loader->pauseLoad(pause);
+}
+#endif
+
void ResourceHandle::setDefersLoading(bool defers)
{
notImplemented();
diff --git a/WebCore/platform/network/android/ResourceLoaderAndroid.h b/WebCore/platform/network/android/ResourceLoaderAndroid.h
index 004675e..f627d62 100644
--- a/WebCore/platform/network/android/ResourceLoaderAndroid.h
+++ b/WebCore/platform/network/android/ResourceLoaderAndroid.h
@@ -42,6 +42,9 @@ public:
virtual void cancel() = 0;
virtual void downloadFile() = 0;
+ // ANDROID TODO: This needs to be upstreamed.
+ virtual void pauseLoad(bool) = 0;
+ // END ANDROID TODO
// Call to java to find out if this URL is in the cache
static bool willLoadFromCache(const WebCore::KURL&, int64_t identifier);
diff --git a/WebCore/plugins/PluginStream.cpp b/WebCore/plugins/PluginStream.cpp
index bf35ba4..1e91c51 100644
--- a/WebCore/plugins/PluginStream.cpp
+++ b/WebCore/plugins/PluginStream.cpp
@@ -345,6 +345,11 @@ void PluginStream::deliverData()
int32 deliveryBytes = m_pluginFuncs->writeready(m_instance, &m_stream);
if (deliveryBytes <= 0) {
+#if PLATFORM(ANDROID)
+// TODO: This needs to be upstreamed.
+ if (m_loader)
+ m_loader->pauseLoad(true);
+#endif
m_delayDeliveryTimer.startOneShot(0);
break;
} else {
@@ -373,6 +378,11 @@ void PluginStream::deliverData()
memmove(m_deliveryData->data(), m_deliveryData->data() + totalBytesDelivered, remainingBytes);
m_deliveryData->resize(remainingBytes);
} else {
+#if PLATFORM(ANDROID)
+//TODO: This needs to be upstreamed to WebKit.
+ if (m_loader)
+ m_loader->pauseLoad(false);
+#endif
m_deliveryData->resize(0);
if (m_reason != WebReasonNone)
destroyStream();