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
}
}
+#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)
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; }
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>*);
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();
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);
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 {
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();
jmethodID mCancelMethodID;
jmethodID mDownloadFileMethodID;
jmethodID mWillLoadFromCacheMethodID;
+ jmethodID mPauseLoadMethodID;
} gResourceLoader;
// ----------------------------------------------------------------------------
}
WebCoreResourceLoader::WebCoreResourceLoader(JNIEnv *env, jobject jLoadListener)
+ : mPausedLoad(false)
{
mJLoader = env->NewGlobalRef(jLoadListener);
}
checkException(env);
}
+void WebCoreResourceLoader::pauseLoad(bool pause)
+{
+ if (mPausedLoad == pause)
+ return;
+
+ mPausedLoad = pause;
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ env->CallVoidMethod(mJLoader, gResourceLoader.mPauseLoadMethodID, pause);
+ checkException(env);
+}
+
/*
* This static method is called to check to see if a POST response is in
* the cache. This may be slow, but is only used during a navigation to
LOG_FATAL_IF(gResourceLoader.mDownloadFileMethodID == NULL,
"Could not find method downloadFile on LoadListener");
+ gResourceLoader.mPauseLoadMethodID =
+ env->GetMethodID(resourceLoader, "pauseLoad", "(Z)V");
+ LOG_FATAL_IF(gResourceLoader.mPauseLoadMethodID == NULL,
+ "Could not find method pauseLoad on LoadListener");
+
gResourceLoader.mWillLoadFromCacheMethodID =
env->GetStaticMethodID(resourceLoader, "willLoadFromCache", "(Ljava/lang/String;J)Z");
LOG_FATAL_IF(gResourceLoader.mWillLoadFromCacheMethodID == NULL,
*/
virtual void downloadFile();
+ virtual void pauseLoad(bool);
+
/**
* Call to java to find out if this URL is in the cache
*/
WebCoreResourceLoader(JNIEnv *env, jobject jLoadListener);
private:
jobject mJLoader;
+ bool mPausedLoad;
};
} // end namespace android