diff options
Diffstat (limited to 'WebKit/android')
-rw-r--r-- | WebKit/android/plugins/PluginTimer.cpp | 16 | ||||
-rw-r--r-- | WebKit/android/plugins/PluginTimer.h | 3 | ||||
-rw-r--r-- | WebKit/android/plugins/PluginWidgetAndroid.cpp | 14 | ||||
-rw-r--r-- | WebKit/android/plugins/PluginWidgetAndroid.h | 2 |
4 files changed, 23 insertions, 12 deletions
diff --git a/WebKit/android/plugins/PluginTimer.cpp b/WebKit/android/plugins/PluginTimer.cpp index ae7cb84..23cac77 100644 --- a/WebKit/android/plugins/PluginTimer.cpp +++ b/WebKit/android/plugins/PluginTimer.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "PluginTimer.h" +#include "RefPtr.h" namespace WebCore { @@ -63,11 +64,14 @@ namespace WebCore { void PluginTimer::fired() { + // ensure the timer cannot be deleted until this method completes + RefPtr<PluginTimer> protector(this); + if (!m_unscheduled) m_timerFunc(m_instance, m_timerID); if (!m_repeat || m_unscheduled) - delete this; + deref(); // mark the timer for deletion as it is no longer needed } // may return null if timerID is not found @@ -84,11 +88,15 @@ namespace WebCore { } /////////////////////////////////////////////////////////////////////////// - + PluginTimerList::~PluginTimerList() { - while (m_list) { - delete m_list; + PluginTimer* curr = m_list; + PluginTimer* next; + while (curr) { + next = curr->next(); + curr->deref(); + curr = next; } } diff --git a/WebKit/android/plugins/PluginTimer.h b/WebKit/android/plugins/PluginTimer.h index dcb29bf..20c0816 100644 --- a/WebKit/android/plugins/PluginTimer.h +++ b/WebKit/android/plugins/PluginTimer.h @@ -27,6 +27,7 @@ #ifndef PluginTimer_H #define PluginTimer_H +#include "RefCounted.h" #include "Timer.h" #include "npapi.h" @@ -34,7 +35,7 @@ namespace WebCore { class PluginTimerList; - class PluginTimer : public TimerBase { + class PluginTimer : public TimerBase, public RefCounted<PluginTimer> { public: PluginTimer(PluginTimer** list, NPP instance, bool repeat, void (*proc)(NPP npp, uint32_t timerID)); diff --git a/WebKit/android/plugins/PluginWidgetAndroid.cpp b/WebKit/android/plugins/PluginWidgetAndroid.cpp index 293c994..73fe18a 100644 --- a/WebKit/android/plugins/PluginWidgetAndroid.cpp +++ b/WebKit/android/plugins/PluginWidgetAndroid.cpp @@ -66,7 +66,7 @@ PluginWidgetAndroid::PluginWidgetAndroid(WebCore::PluginView* view) m_hasFocus = false; m_isFullScreen = false; m_visible = false; - m_zoomLevel = 0; + m_cachedZoomLevel = 0; m_embeddedView = NULL; m_embeddedViewAttached = false; m_acceptEvents = false; @@ -359,15 +359,17 @@ bool PluginWidgetAndroid::isAcceptingEvent(ANPEventFlag flag) { void PluginWidgetAndroid::sendSizeAndVisibilityEvents(const bool updateDimensions) { // TODO update the bitmap size based on the zoom? (for kBitmap_ANPDrawingModel) + const float zoomLevel = m_core->scale(); + // notify the plugin of the new size if (m_drawingModel == kOpenGL_ANPDrawingModel && updateDimensions) { PLUGIN_LOG("%s (%d,%d)[%f]", __FUNCTION__, m_pluginWindow->width, - m_pluginWindow->height, m_zoomLevel); + m_pluginWindow->height, zoomLevel); ANPEvent event; SkANP::InitEvent(&event, kDraw_ANPEventType); event.data.draw.model = kOpenGL_ANPDrawingModel; - event.data.draw.data.surface.width = m_pluginWindow->width * m_zoomLevel; - event.data.draw.data.surface.height = m_pluginWindow->height * m_zoomLevel; + event.data.draw.data.surface.width = m_pluginWindow->width * zoomLevel; + event.data.draw.data.surface.height = m_pluginWindow->height * zoomLevel; sendEvent(event); } @@ -401,10 +403,10 @@ void PluginWidgetAndroid::setVisibleScreen(const ANPRectI& visibleDocRect, float int oldScreenW = m_visibleDocRect.width(); int oldScreenH = m_visibleDocRect.height(); - const bool zoomChanged = m_zoomLevel != zoom; + const bool zoomChanged = m_cachedZoomLevel != zoom; // make local copies of the parameters - m_zoomLevel = zoom; + m_cachedZoomLevel = zoom; m_visibleDocRect.set(visibleDocRect.left, visibleDocRect.top, visibleDocRect.right, diff --git a/WebKit/android/plugins/PluginWidgetAndroid.h b/WebKit/android/plugins/PluginWidgetAndroid.h index f6bc703..fa01b41 100644 --- a/WebKit/android/plugins/PluginWidgetAndroid.h +++ b/WebKit/android/plugins/PluginWidgetAndroid.h @@ -193,7 +193,7 @@ private: bool m_hasFocus; bool m_isFullScreen; bool m_visible; - float m_zoomLevel; + float m_cachedZoomLevel; // used for comparison only jobject m_embeddedView; bool m_embeddedViewAttached; bool m_acceptEvents; |