OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/renderer_host/render_widget_host.h" | 5 #include "chrome/browser/renderer_host/render_widget_host.h" |
6 | 6 |
7 #include "base/gfx/native_widget_types.h" | 7 #include "base/gfx/native_widget_types.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/keyboard_codes.h" | 9 #include "base/keyboard_codes.h" |
10 #include "chrome/browser/renderer_host/backing_store.h" | 10 #include "chrome/browser/renderer_host/backing_store.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 ViewHostMsg_PaintRect::Dispatch( | 223 ViewHostMsg_PaintRect::Dispatch( |
224 &msg, this, &RenderWidgetHost::OnMsgPaintRect); | 224 &msg, this, &RenderWidgetHost::OnMsgPaintRect); |
225 suppress_view_updating_ = false; | 225 suppress_view_updating_ = false; |
226 backing_store = BackingStoreManager::GetBackingStore(this, current_size_); | 226 backing_store = BackingStoreManager::GetBackingStore(this, current_size_); |
227 } | 227 } |
228 } | 228 } |
229 | 229 |
230 return backing_store; | 230 return backing_store; |
231 } | 231 } |
232 | 232 |
| 233 BackingStore* RenderWidgetHost::AllocBackingStore(const gfx::Size& size) { |
| 234 if (!view_) |
| 235 return NULL; |
| 236 |
| 237 return view_->AllocBackingStore(size); |
| 238 } |
| 239 |
233 void RenderWidgetHost::StartHangMonitorTimeout(TimeDelta delay) { | 240 void RenderWidgetHost::StartHangMonitorTimeout(TimeDelta delay) { |
234 time_when_considered_hung_ = Time::Now() + delay; | 241 time_when_considered_hung_ = Time::Now() + delay; |
235 | 242 |
236 // If we already have a timer that will expire at or before the given delay, | 243 // If we already have a timer that will expire at or before the given delay, |
237 // then we have nothing more to do now. | 244 // then we have nothing more to do now. |
238 if (hung_renderer_timer_.IsRunning() && | 245 if (hung_renderer_timer_.IsRunning() && |
239 hung_renderer_timer_.GetCurrentDelay() <= delay) | 246 hung_renderer_timer_.GetCurrentDelay() <= delay) |
240 return; | 247 return; |
241 | 248 |
242 // Either the timer is not yet running, or we need to adjust the timer to | 249 // Either the timer is not yet running, or we need to adjust the timer to |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 const gfx::Rect& bitmap_rect, | 592 const gfx::Rect& bitmap_rect, |
586 const gfx::Size& view_size) { | 593 const gfx::Size& view_size) { |
587 if (is_hidden_) { | 594 if (is_hidden_) { |
588 // Don't bother updating the backing store when we're hidden. Just mark it | 595 // Don't bother updating the backing store when we're hidden. Just mark it |
589 // as being totally invalid. This will cause a complete repaint when the | 596 // as being totally invalid. This will cause a complete repaint when the |
590 // view is restored. | 597 // view is restored. |
591 needs_repainting_on_restore_ = true; | 598 needs_repainting_on_restore_ = true; |
592 return; | 599 return; |
593 } | 600 } |
594 | 601 |
595 // We use the view size according to the render view, which may not be | |
596 // quite the same as the size of our window. | |
597 gfx::Rect view_rect(0, 0, view_size.width(), view_size.height()); | |
598 | |
599 bool needs_full_paint = false; | 602 bool needs_full_paint = false; |
600 BackingStore* backing_store = | 603 BackingStore* backing_store = |
601 BackingStoreManager::PrepareBackingStore(this, view_rect, | 604 BackingStoreManager::PrepareBackingStore(this, view_size, |
602 process_->process().handle(), | 605 process_->process().handle(), |
603 bitmap, bitmap_rect, | 606 bitmap, bitmap_rect, |
604 &needs_full_paint); | 607 &needs_full_paint); |
605 DCHECK(backing_store != NULL); | 608 DCHECK(backing_store != NULL); |
606 if (needs_full_paint) { | 609 if (needs_full_paint) { |
607 repaint_start_time_ = TimeTicks::Now(); | 610 repaint_start_time_ = TimeTicks::Now(); |
608 repaint_ack_pending_ = true; | 611 repaint_ack_pending_ = true; |
609 Send(new ViewMsg_Repaint(routing_id_, view_size)); | 612 Send(new ViewMsg_Repaint(routing_id_, view_size)); |
610 } | 613 } |
611 } | 614 } |
(...skipping 13 matching lines...) Expand all Loading... |
625 | 628 |
626 // TODO(darin): do we need to do something else if our backing store is not | 629 // TODO(darin): do we need to do something else if our backing store is not |
627 // the same size as the advertised view? maybe we just assume there is a | 630 // the same size as the advertised view? maybe we just assume there is a |
628 // full paint on its way? | 631 // full paint on its way? |
629 BackingStore* backing_store = BackingStoreManager::Lookup(this); | 632 BackingStore* backing_store = BackingStoreManager::Lookup(this); |
630 if (!backing_store || (backing_store->size() != view_size)) | 633 if (!backing_store || (backing_store->size() != view_size)) |
631 return; | 634 return; |
632 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, | 635 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, |
633 dx, dy, clip_rect, view_size); | 636 dx, dy, clip_rect, view_size); |
634 } | 637 } |
OLD | NEW |