summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/render_widget.cc
diff options
context:
space:
mode:
authoriyengar@google.com <iyengar@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-06 05:30:12 +0000
committeriyengar@google.com <iyengar@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-06 05:30:12 +0000
commitec7dc1160836695462ee7311d4c02f2c2f61350e (patch)
tree9fb3d234403ee1b52ca24f603dbedede952a4948 /chrome/renderer/render_widget.cc
parente5d478012a5ee0765d35fd62e5090d07f5ae7dde (diff)
downloadchromium_src-ec7dc1160836695462ee7311d4c02f2c2f61350e.zip
chromium_src-ec7dc1160836695462ee7311d4c02f2c2f61350e.tar.gz
chromium_src-ec7dc1160836695462ee7311d4c02f2c2f61350e.tar.bz2
This fixes http://b/issue?id=1257424, which is a need to implement a global backing store cache. The current backing store cache is only used for invisible tabs and every other RenderWidgetHost holds a reference to its backing store.
This CB proposes a change where in we have a global backing store cache, whose size can be controlled based on strategies like available resources etc. At this point the strategy is not implemented and the size is left at 5. We no longer maintain a reference to the backing store in the RenderWidgetHost. Every host queries the global cache for its backing store. The cache provides methods to create the backing store and populate it with the required dib. The other change is to use the renderer dib when the size of the bitmap being painted is the same as the backing store size. This is an attempt to improve performance in operations like scrolling. Bug=1257424 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@422 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_widget.cc')
-rw-r--r--chrome/renderer/render_widget.cc30
1 files changed, 24 insertions, 6 deletions
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc
index c5db805..2560438 100644
--- a/chrome/renderer/render_widget.cc
+++ b/chrome/renderer/render_widget.cc
@@ -182,6 +182,7 @@ IPC_DEFINE_MESSAGE_MAP(RenderWidget)
IPC_MESSAGE_HANDLER(ViewMsg_SetFocus, OnSetFocus)
IPC_MESSAGE_HANDLER(ViewMsg_ImeSetInputMode, OnImeSetInputMode)
IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition)
+ IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnMsgRepaint)
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP()
@@ -295,17 +296,24 @@ void RenderWidget::OnWasRestored(bool needs_repainting) {
DidInvalidateRect(webwidget_, gfx::Rect(size_.width(), size_.height()));
}
-void RenderWidget::OnPaintRectAck() {
+void RenderWidget::OnPaintRectAck(bool drop_bitmap) {
DCHECK(paint_reply_pending());
paint_reply_pending_ = false;
- // If we sent a PaintRect message with a zero-sized bitmap, then
- // we should have no current paint buf.
- if (current_paint_buf_) {
- RenderProcess::FreeSharedMemory(current_paint_buf_);
- current_paint_buf_ = NULL;
+ if (drop_bitmap) {
+ if (current_paint_buf_) {
+ RenderProcess::DeleteSharedMem(current_paint_buf_);
+ }
+ } else {
+ // If we sent a PaintRect message with a zero-sized bitmap, then
+ // we should have no current paint buf.
+ if (current_paint_buf_) {
+ RenderProcess::FreeSharedMemory(current_paint_buf_);
+ }
}
+ current_paint_buf_ = NULL;
+
// Continue painting if necessary...
DoDeferredPaint();
}
@@ -691,6 +699,16 @@ void RenderWidget::OnImeSetComposition(int string_type,
}
}
+void RenderWidget::OnMsgRepaint(const gfx::Size& size_to_paint) {
+ // During shutdown we can just ignore this message.
+ if (!webwidget_)
+ return;
+
+ set_next_paint_is_repaint_ack();
+ gfx::Rect repaint_rect(size_to_paint.width(), size_to_paint.height());
+ DidInvalidateRect(webwidget_, repaint_rect);
+}
+
void RenderWidget::UpdateIME() {
// If a browser process does not have IMEs, its IMEs are not active, or there
// are not any attached widgets.