summaryrefslogtreecommitdiffstats
path: root/WebKit/android
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2010-02-22 11:56:11 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2010-02-22 11:56:11 -0800
commit85e36527080daf007a2b533d00cd04968b28c7b8 (patch)
tree23491bb0cded98f2bda73128c825e4a2847d74f8 /WebKit/android
parent41084a8fbaa3b6914ecfb085be8a9f32bebfb55b (diff)
parent4c76da0e5177ea82be36bb81e67b52d51a5a72bb (diff)
downloadexternal_webkit-85e36527080daf007a2b533d00cd04968b28c7b8.zip
external_webkit-85e36527080daf007a2b533d00cd04968b28c7b8.tar.gz
external_webkit-85e36527080daf007a2b533d00cd04968b28c7b8.tar.bz2
am 4c76da0e: am 1044e7fd: Fixes error where plugin is created while iterating through the list of plugins.
Merge commit '4c76da0e5177ea82be36bb81e67b52d51a5a72bb' * commit '4c76da0e5177ea82be36bb81e67b52d51a5a72bb': Fixes error where plugin is created while iterating through the list of plugins.
Diffstat (limited to 'WebKit/android')
-rw-r--r--WebKit/android/jni/WebViewCore.cpp27
-rw-r--r--WebKit/android/jni/WebViewCore.h3
2 files changed, 13 insertions, 17 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index a68ada8..7130d8f 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -1367,6 +1367,10 @@ void WebViewCore::updateFrameCacheIfLoading()
void WebViewCore::addPlugin(PluginWidgetAndroid* w)
{
// SkDebugf("----------- addPlugin %p", w);
+ /* The plugin must be appended to the end of the array. This ensures that if
+ the plugin is added while iterating through the array (e.g. sendEvent(...))
+ that the iteration process is not corrupted.
+ */
*m_plugins.append() = w;
}
@@ -1464,22 +1468,17 @@ void WebViewCore::sendPluginVisibleScreen()
}
}
-void WebViewCore::sendPluginEvent(const ANPEvent& evt, ANPEventFlag flag)
-{
- PluginWidgetAndroid** iter = m_plugins.begin();
- PluginWidgetAndroid** stop = m_plugins.end();
- for (; iter < stop; ++iter) {
- if((*iter)->isAcceptingEvent(flag))
- (*iter)->sendEvent(evt);
- }
-}
-
void WebViewCore::sendPluginEvent(const ANPEvent& evt)
{
- PluginWidgetAndroid** iter = m_plugins.begin();
- PluginWidgetAndroid** stop = m_plugins.end();
- for (; iter < stop; ++iter) {
- (*iter)->sendEvent(evt);
+ /* The list of plugins may be manipulated as we iterate through the list.
+ This implementation allows for the addition of new plugins during an
+ iteration, but may fail if a plugin is removed. Currently, there are not
+ any use cases where a plugin is deleted while processing this loop, but
+ if it does occur we will have to use an alternate data structure and/or
+ iteration mechanism.
+ */
+ for (int x = 0; x < m_plugins.count(); x++) {
+ m_plugins[x]->sendEvent(evt);
}
}
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index c6c3dee..aca06d1 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -365,9 +365,6 @@ namespace android {
// send this event to all of the plugins in our list
void sendPluginEvent(const ANPEvent&);
- // send this event to all of the plugins who have the given flag set
- void sendPluginEvent(const ANPEvent& evt, ANPEventFlag flag);
-
// lookup the plugin widget struct given an NPP
PluginWidgetAndroid* getPluginWidget(NPP npp);