diff options
author | Andrei Popescu <andreip@google.com> | 2010-03-30 09:54:23 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-03-30 09:54:23 -0700 |
commit | 4b7d2805ff99aafc2fbcdd38cd9a505f99847bd8 (patch) | |
tree | af84b91719a2a4836cc0397ca42aa525b131d02e /WebCore | |
parent | 2eba8dcfad57fc753029296850e489032f0a5c6e (diff) | |
parent | f9115700a452dad0c9d5d9556045d0be30da33ad (diff) | |
download | external_webkit-4b7d2805ff99aafc2fbcdd38cd9a505f99847bd8.zip external_webkit-4b7d2805ff99aafc2fbcdd38cd9a505f99847bd8.tar.gz external_webkit-4b7d2805ff99aafc2fbcdd38cd9a505f99847bd8.tar.bz2 |
Merge "Ask the plugin how long to wait before calling NPN_WriteReady() again." into froyo
Diffstat (limited to 'WebCore')
-rw-r--r-- | WebCore/bridge/npapi.h | 9 | ||||
-rw-r--r-- | WebCore/plugins/PluginStream.cpp | 21 | ||||
-rw-r--r-- | WebCore/plugins/PluginStream.h | 4 |
3 files changed, 30 insertions, 4 deletions
diff --git a/WebCore/bridge/npapi.h b/WebCore/bridge/npapi.h index 41f9bda..f0690b9 100644 --- a/WebCore/bridge/npapi.h +++ b/WebCore/bridge/npapi.h @@ -374,8 +374,13 @@ typedef enum { NPPVpluginCoreAnimationLayer = 1003 #endif -#ifdef ANDROID - // TODO(andreip): Remove? +#if PLATFORM(ANDROID) + /* Used when the plugin returns 0 from NPN_WriteReady and wishes the browser + * to wait a certain amount of millis before calling NPN_WriteReady again. + */ + NPPDataDeliveryDelayMs = 100, + + // TODO(reed): upstream NPPFakeValueToForce32Bits = 0x7FFFFFFF #endif } NPPVariable; diff --git a/WebCore/plugins/PluginStream.cpp b/WebCore/plugins/PluginStream.cpp index 1e91c51..0f60fe3 100644 --- a/WebCore/plugins/PluginStream.cpp +++ b/WebCore/plugins/PluginStream.cpp @@ -349,8 +349,13 @@ void PluginStream::deliverData() // TODO: This needs to be upstreamed. if (m_loader) m_loader->pauseLoad(true); -#endif + + // ask the plugin for a delay value. + int delay = deliveryDelay(); + m_delayDeliveryTimer.startOneShot(delay); +#else m_delayDeliveryTimer.startOneShot(0); +#endif break; } else { deliveryBytes = min(deliveryBytes, totalBytes - totalBytesDelivered); @@ -485,4 +490,18 @@ bool PluginStream::wantsAllStreams() const return result != 0; } +#if PLATFORM(ANDROID) +int PluginStream::deliveryDelay() const +{ + if (!m_pluginFuncs->getvalue) + return 0; + + int delay = 0; + if (m_pluginFuncs->getvalue(m_instance, NPPDataDeliveryDelayMs, &delay) != NPERR_NO_ERROR) + return 0; + + return delay; +} +#endif + } diff --git a/WebCore/plugins/PluginStream.h b/WebCore/plugins/PluginStream.h index dc08f01..29a2644 100644 --- a/WebCore/plugins/PluginStream.h +++ b/WebCore/plugins/PluginStream.h @@ -88,7 +88,9 @@ namespace WebCore { void deliverData(); void destroyStream(NPReason); void destroyStream(); - +#if PLATFORM(ANDROID) + int deliveryDelay() const; +#endif ResourceRequest m_resourceRequest; ResourceResponse m_resourceResponse; |