diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-18 15:52:54 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-18 15:52:54 +0000 |
commit | 9de65c8b3f17f28ff7edebb63f0922f5734bf55b (patch) | |
tree | 7ec8c5b258e930a9c1c1682f451fc877f640f780 /chrome/common | |
parent | cd7bc4ed28abcb9a3652d4e3f6ffa2fe9f503aae (diff) | |
download | chromium_src-9de65c8b3f17f28ff7edebb63f0922f5734bf55b.zip chromium_src-9de65c8b3f17f28ff7edebb63f0922f5734bf55b.tar.gz chromium_src-9de65c8b3f17f28ff7edebb63f0922f5734bf55b.tar.bz2 |
Revert 34951 - Combine ViewHostMsg_{Paint,Scroll}Rect into one IPC.
The combined IPC means that scrolling only requires one transport DIB instead
of two. Previously, we'd use one in the ScrollRect IPC to pass up the pixels
for the exposed region, and then we'd use a second one in the PaintRect IPC to
pass up the pixels for the updated scroll bar rendering. Now all paints are
done using a single transport DIB.
Optimize RenderWidgetHostViewWin::OnPaint to only paint the damaged regions.
This means calling GetUpdateRgn and GetRegionData to enumerate the list of
damage rects. Then only those rects are copied from the backing store.
The same optimization is not done for Linux or Mac yet.
R=brettw
BUG=29591
TEST=none
Review URL: http://codereview.chromium.org/506013
TBR=darin@chromium.org
Review URL: http://codereview.chromium.org/506075
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34953 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/render_messages.h | 111 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 23 |
2 files changed, 92 insertions, 42 deletions
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index c886522..9e2e6fc 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -176,8 +176,8 @@ struct ViewHostMsg_FrameNavigate_Params { }; // Values that may be OR'd together to form the 'flags' parameter of a -// ViewHostMsg_UpdateRect_Params structure. -struct ViewHostMsg_UpdateRect_Flags { +// ViewHostMsg_PaintRect message. +struct ViewHostMsg_PaintRect_Flags { enum { IS_RESIZE_ACK = 1 << 0, IS_RESTORE_ACK = 1 << 1, @@ -189,12 +189,13 @@ struct ViewHostMsg_UpdateRect_Flags { static bool is_restore_ack(int flags) { return (flags & IS_RESTORE_ACK) != 0; } + static bool is_repaint_ack(int flags) { return (flags & IS_REPAINT_ACK) != 0; } }; -struct ViewHostMsg_UpdateRect_Params { +struct ViewHostMsg_PaintRect_Params { // The bitmap to be painted into the view at the locations specified by // update_rects. TransportDIB::Id bitmap; @@ -202,18 +203,8 @@ struct ViewHostMsg_UpdateRect_Params { // The position and size of the bitmap. gfx::Rect bitmap_rect; - // The scroll offset. Only one of these can be non-zero, and if they are - // both zero, then it means there is no scrolling and the scroll_rect is - // ignored. - int dx; - int dy; - - // The rectangular region to scroll. - gfx::Rect scroll_rect; - // The regions of the bitmap (in view coords) that contain updated pixels. - // In the case of scrolling, this includes the scroll damage rect. - std::vector<gfx::Rect> copy_rects; + std::vector<gfx::Rect> update_rects; // The size of the RenderView when this message was generated. This is // included so the host knows how large the view is from the perspective of @@ -226,22 +217,42 @@ struct ViewHostMsg_UpdateRect_Params { // The following describes the various bits that may be set in flags: // - // ViewHostMsg_UpdateRect_Flags::IS_RESIZE_ACK + // ViewHostMsg_PaintRect_Flags::IS_RESIZE_ACK // Indicates that this is a response to a ViewMsg_Resize message. // - // ViewHostMsg_UpdateRect_Flags::IS_RESTORE_ACK + // ViewHostMsg_PaintRect_Flags::IS_RESTORE_ACK // Indicates that this is a response to a ViewMsg_WasRestored message. // - // ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK - // Indicates that this is a response to a ViewMsg_Repaint message. - // // If flags is zero, then this message corresponds to an unsoliticed paint - // request by the render view. Any of the above bits may be set in flags, + // request by the render view. Both of the above bits may be set in flags, // which would indicate that this paint message is an ACK for multiple // request messages. int flags; }; +// Parameters structure for ViewHostMsg_ScrollRect, which has too many data +// parameters to be reasonably put in a predefined IPC message. +struct ViewHostMsg_ScrollRect_Params { + // The bitmap to be painted into the rect exposed by scrolling. + TransportDIB::Id bitmap; + + // The position and size of the bitmap. + gfx::Rect bitmap_rect; + + // The scroll offset. Only one of these can be non-zero. + int dx; + int dy; + + // The rectangular region to scroll. + gfx::Rect clip_rect; + + // The size of the RenderView when this message was generated. + gfx::Size view_size; + + // New window locations for plugin child windows. + std::vector<webkit_glue::WebPluginGeometry> plugin_window_moves; +}; + // Information on closing a tab. This is used both for ViewMsg_ClosePage, and // the corresponding ViewHostMsg_ClosePage_ACK. struct ViewMsg_ClosePage_Params { @@ -967,20 +978,56 @@ struct ParamTraits<ContextMenuParams> { } }; -// Traits for ViewHostMsg_UpdateRect_Params structure to pack/unpack. +// Traits for ViewHostMsg_PaintRect_Params structure to pack/unpack. template <> -struct ParamTraits<ViewHostMsg_UpdateRect_Params> { - typedef ViewHostMsg_UpdateRect_Params param_type; +struct ParamTraits<ViewHostMsg_PaintRect_Params> { + typedef ViewHostMsg_PaintRect_Params param_type; + static void Write(Message* m, const param_type& p) { + WriteParam(m, p.bitmap); + WriteParam(m, p.bitmap_rect); + WriteParam(m, p.update_rects); + WriteParam(m, p.view_size); + WriteParam(m, p.plugin_window_moves); + WriteParam(m, p.flags); + } + static bool Read(const Message* m, void** iter, param_type* p) { + return + ReadParam(m, iter, &p->bitmap) && + ReadParam(m, iter, &p->bitmap_rect) && + ReadParam(m, iter, &p->update_rects) && + ReadParam(m, iter, &p->view_size) && + ReadParam(m, iter, &p->plugin_window_moves) && + ReadParam(m, iter, &p->flags); + } + static void Log(const param_type& p, std::wstring* l) { + l->append(L"("); + LogParam(p.bitmap, l); + l->append(L", "); + LogParam(p.bitmap_rect, l); + l->append(L", "); + LogParam(p.update_rects, l); + l->append(L", "); + LogParam(p.view_size, l); + l->append(L", "); + LogParam(p.plugin_window_moves, l); + l->append(L", "); + LogParam(p.flags, l); + l->append(L")"); + } +}; + +// Traits for ViewHostMsg_ScrollRect_Params structure to pack/unpack. +template <> +struct ParamTraits<ViewHostMsg_ScrollRect_Params> { + typedef ViewHostMsg_ScrollRect_Params param_type; static void Write(Message* m, const param_type& p) { WriteParam(m, p.bitmap); WriteParam(m, p.bitmap_rect); WriteParam(m, p.dx); WriteParam(m, p.dy); - WriteParam(m, p.scroll_rect); - WriteParam(m, p.copy_rects); + WriteParam(m, p.clip_rect); WriteParam(m, p.view_size); WriteParam(m, p.plugin_window_moves); - WriteParam(m, p.flags); } static bool Read(const Message* m, void** iter, param_type* p) { return @@ -988,11 +1035,9 @@ struct ParamTraits<ViewHostMsg_UpdateRect_Params> { ReadParam(m, iter, &p->bitmap_rect) && ReadParam(m, iter, &p->dx) && ReadParam(m, iter, &p->dy) && - ReadParam(m, iter, &p->scroll_rect) && - ReadParam(m, iter, &p->copy_rects) && + ReadParam(m, iter, &p->clip_rect) && ReadParam(m, iter, &p->view_size) && - ReadParam(m, iter, &p->plugin_window_moves) && - ReadParam(m, iter, &p->flags); + ReadParam(m, iter, &p->plugin_window_moves); } static void Log(const param_type& p, std::wstring* l) { l->append(L"("); @@ -1004,15 +1049,11 @@ struct ParamTraits<ViewHostMsg_UpdateRect_Params> { l->append(L", "); LogParam(p.dy, l); l->append(L", "); - LogParam(p.scroll_rect, l); - l->append(L", "); - LogParam(p.copy_rects, l); + LogParam(p.clip_rect, l); l->append(L", "); LogParam(p.view_size, l); l->append(L", "); LogParam(p.plugin_window_moves, l); - l->append(L", "); - LogParam(p.flags, l); l->append(L")"); } }; diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index ca3e80b..3f9a1f1 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -128,6 +128,10 @@ IPC_BEGIN_MESSAGES(View) // render view responds with a ViewHostMsg_Thumbnail. IPC_MESSAGE_ROUTED0(ViewMsg_CaptureThumbnail) + // Tells the render view that a ViewHostMsg_PaintRect message was processed. + // This signals the render view that it can send another PaintRect message. + IPC_MESSAGE_ROUTED0(ViewMsg_PaintRect_ACK) + // Tells the render view to switch the CSS to print media type, renders every // requested pages and switch back the CSS to display media type. IPC_MESSAGE_ROUTED0(ViewMsg_PrintPages) @@ -143,9 +147,9 @@ IPC_BEGIN_MESSAGES(View) // JS garbage, not in purging irreplaceable objects. IPC_MESSAGE_CONTROL0(ViewMsg_PurgeMemory) - // Tells the render view that a ViewHostMsg_UpdateRect message was processed. - // This signals the render view that it can send another UpdateRect message. - IPC_MESSAGE_ROUTED0(ViewMsg_UpdateRect_ACK) + // Tells the render view that a ViewHostMsg_ScrollRect message was processed. + // This signals the render view that it can send another ScrollRect message. + IPC_MESSAGE_ROUTED0(ViewMsg_ScrollRect_ACK) // Message payload includes: // 1. A blob that should be cast to WebInputEvent @@ -989,10 +993,15 @@ IPC_BEGIN_MESSAGES(ViewHost) navigating to a POST again and we're going to show the POST interstitial */ ) - // Sent to update part of the view. In response to this message, the host - // generates a ViewMsg_UpdateRect_ACK message. - IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateRect, - ViewHostMsg_UpdateRect_Params) + // Sent to paint part of the view. In response to this message, the host + // generates a ViewMsg_PaintRect_ACK message. + IPC_MESSAGE_ROUTED1(ViewHostMsg_PaintRect, + ViewHostMsg_PaintRect_Params) + + // Sent to scroll part of the view. In response to this message, the host + // generates a ViewMsg_ScrollRect_ACK message. + IPC_MESSAGE_ROUTED1(ViewHostMsg_ScrollRect, + ViewHostMsg_ScrollRect_Params) // Acknowledges receipt of a ViewMsg_HandleInputEvent message. // Payload is a WebInputEvent::Type which is the type of the event, followed |