diff options
Diffstat (limited to 'chrome/plugin')
-rw-r--r-- | chrome/plugin/webplugin_proxy.cc | 28 | ||||
-rw-r--r-- | chrome/plugin/webplugin_proxy.h | 5 |
2 files changed, 6 insertions, 27 deletions
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc index 255c843..2cbb3ee 100644 --- a/chrome/plugin/webplugin_proxy.cc +++ b/chrome/plugin/webplugin_proxy.cc @@ -34,9 +34,7 @@ WebPluginProxy::WebPluginProxy( window_npobject_(NULL), plugin_element_(NULL), delegate_(delegate), - waiting_for_paint_(false), -#pragma warning(suppress: 4355) // can use this - runnable_method_factory_(this) { + waiting_for_paint_(false) { HANDLE event; BOOL result = DuplicateHandle(channel->renderer_handle(), @@ -86,22 +84,21 @@ void WebPluginProxy::Invalidate() { } void WebPluginProxy::InvalidateRect(const gfx::Rect& rect) { - damaged_rect_ = damaged_rect_.Union(rect); // Ignore NPN_InvalidateRect calls with empty rects. Also don't send an // invalidate if it's outside the clipping region, since if we did it won't // lead to a paint and we'll be stuck waiting forever for a DidPaint response. if (rect.IsEmpty() || !delegate_->clip_rect().Intersects(rect)) return; + damaged_rect_ = damaged_rect_.Union(rect); // Only send a single InvalidateRect message at a time. From DidPaint we // will dispatch an additional InvalidateRect message if necessary. if (!waiting_for_paint_) { waiting_for_paint_ = true; - // Invalidates caused by calls to NPN_InvalidateRect/NPN_InvalidateRgn - // need to be painted asynchronously as per the NPAPI spec. - MessageLoop::current()->PostTask(FROM_HERE, - runnable_method_factory_.NewRunnableMethod( - &WebPluginProxy::OnPaint, damaged_rect_)); + // Paint to the plugin bitmap and let the renderer know so it can update + // its backing store. + Paint(damaged_rect_); + Send(new PluginHostMsg_InvalidateRect(route_id_, damaged_rect_)); damaged_rect_ = gfx::Rect(); } } @@ -285,8 +282,6 @@ void WebPluginProxy::UpdateGeometry( const base::SharedMemoryHandle& windowless_buffer, const base::SharedMemoryHandle& background_buffer) { gfx::Rect old = delegate_->rect(); - gfx::Rect old_clip_rect = delegate_->clip_rect(); - bool moved = delegate_->rect().x() != window_rect.x() || delegate_->rect().y() != window_rect.y(); delegate_->UpdateGeometry(window_rect, clip_rect, cutout_rects, visible); @@ -297,12 +292,6 @@ void WebPluginProxy::UpdateGeometry( // The plugin moved, so update our world transform. UpdateTransform(); } - // Send over any pending invalidates which occured when the plugin was - // off screen. - if (visible && delegate_->windowless() && !clip_rect.IsEmpty() && - old_clip_rect.IsEmpty() && !damaged_rect_.IsEmpty()) { - InvalidateRect(damaged_rect_); - } } void WebPluginProxy::SetWindowlessBuffer( @@ -387,8 +376,3 @@ void WebPluginProxy::InitiateHTTPRangeRequest(const char* url, range_info, existing_stream, notify_needed, notify_data)); } - -void WebPluginProxy::OnPaint(const gfx::Rect& damaged_rect) { - Paint(damaged_rect); - Send(new PluginHostMsg_InvalidateRect(route_id_, damaged_rect)); -} diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h index c2cefc7..e6a231d 100644 --- a/chrome/plugin/webplugin_proxy.h +++ b/chrome/plugin/webplugin_proxy.h @@ -108,9 +108,6 @@ class WebPluginProxy : public WebPlugin { ScopedBitmap* bitmap, ScopedHDC* hdc); - // Handler for sending over the paint event to the plugin. - void OnPaint(const gfx::Rect& damaged_rect); - // Called when a plugin's origin moves, so that we can update the world // transform of the local HDC. void UpdateTransform(); @@ -140,8 +137,6 @@ class WebPluginProxy : public WebPlugin { ScopedHandle background_shared_section_; ScopedBitmap background_bitmap_; ScopedHDC background_hdc_; - - ScopedRunnableMethodFactory<WebPluginProxy> runnable_method_factory_; }; #endif // CHROME_PLUGIN_PLUGIN_WEBPLUGIN_PROXY_H__ |