| 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 if (is_resize_ack) { | 411 if (is_resize_ack) { |
| 412 DCHECK(resize_ack_pending_); | 412 DCHECK(resize_ack_pending_); |
| 413 resize_ack_pending_ = false; | 413 resize_ack_pending_ = false; |
| 414 } | 414 } |
| 415 | 415 |
| 416 bool is_repaint_ack = | 416 bool is_repaint_ack = |
| 417 ViewHostMsg_PaintRect_Flags::is_repaint_ack(params.flags); | 417 ViewHostMsg_PaintRect_Flags::is_repaint_ack(params.flags); |
| 418 if (is_repaint_ack) { | 418 if (is_repaint_ack) { |
| 419 repaint_ack_pending_ = false; | 419 repaint_ack_pending_ = false; |
| 420 TimeDelta delta = TimeTicks::Now() - repaint_start_time_; | 420 TimeDelta delta = TimeTicks::Now() - repaint_start_time_; |
| 421 UMA_HISTOGRAM_TIMES(L"MPArch.RWH_RepaintDelta", delta); | 421 UMA_HISTOGRAM_TIMES("MPArch.RWH_RepaintDelta", delta); |
| 422 } | 422 } |
| 423 | 423 |
| 424 DCHECK(!params.bitmap_rect.IsEmpty()); | 424 DCHECK(!params.bitmap_rect.IsEmpty()); |
| 425 DCHECK(!params.view_size.IsEmpty()); | 425 DCHECK(!params.view_size.IsEmpty()); |
| 426 | 426 |
| 427 const size_t size = params.bitmap_rect.height() * | 427 const size_t size = params.bitmap_rect.height() * |
| 428 params.bitmap_rect.width() * 4; | 428 params.bitmap_rect.width() * 4; |
| 429 TransportDIB* dib = process_->GetTransportDIB(params.bitmap); | 429 TransportDIB* dib = process_->GetTransportDIB(params.bitmap); |
| 430 if (dib) { | 430 if (dib) { |
| 431 if (dib->size() < size) { | 431 if (dib->size() < size) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 if (is_resize_ack && view_) { | 468 if (is_resize_ack && view_) { |
| 469 gfx::Rect view_bounds = view_->GetViewBounds(); | 469 gfx::Rect view_bounds = view_->GetViewBounds(); |
| 470 if (current_size_.width() != view_bounds.width() || | 470 if (current_size_.width() != view_bounds.width() || |
| 471 current_size_.height() != view_bounds.height()) { | 471 current_size_.height() != view_bounds.height()) { |
| 472 WasResized(); | 472 WasResized(); |
| 473 } | 473 } |
| 474 } | 474 } |
| 475 | 475 |
| 476 // Log the time delta for processing a paint message. | 476 // Log the time delta for processing a paint message. |
| 477 TimeDelta delta = TimeTicks::Now() - paint_start; | 477 TimeDelta delta = TimeTicks::Now() - paint_start; |
| 478 UMA_HISTOGRAM_TIMES(L"MPArch.RWH_OnMsgPaintRect", delta); | 478 UMA_HISTOGRAM_TIMES("MPArch.RWH_OnMsgPaintRect", delta); |
| 479 } | 479 } |
| 480 | 480 |
| 481 void RenderWidgetHost::OnMsgScrollRect( | 481 void RenderWidgetHost::OnMsgScrollRect( |
| 482 const ViewHostMsg_ScrollRect_Params& params) { | 482 const ViewHostMsg_ScrollRect_Params& params) { |
| 483 TimeTicks scroll_start = TimeTicks::Now(); | 483 TimeTicks scroll_start = TimeTicks::Now(); |
| 484 | 484 |
| 485 DCHECK(!params.view_size.IsEmpty()); | 485 DCHECK(!params.view_size.IsEmpty()); |
| 486 | 486 |
| 487 const size_t size = params.bitmap_rect.height() * | 487 const size_t size = params.bitmap_rect.height() * |
| 488 params.bitmap_rect.width() * 4; | 488 params.bitmap_rect.width() * 4; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 514 // Paint the view. Watch out: it might be destroyed already. | 514 // Paint the view. Watch out: it might be destroyed already. |
| 515 if (view_) { | 515 if (view_) { |
| 516 view_being_painted_ = true; | 516 view_being_painted_ = true; |
| 517 view_->MovePluginWindows(params.plugin_window_moves); | 517 view_->MovePluginWindows(params.plugin_window_moves); |
| 518 view_->DidScrollRect(params.clip_rect, params.dx, params.dy); | 518 view_->DidScrollRect(params.clip_rect, params.dx, params.dy); |
| 519 view_being_painted_ = false; | 519 view_being_painted_ = false; |
| 520 } | 520 } |
| 521 | 521 |
| 522 // Log the time delta for processing a scroll message. | 522 // Log the time delta for processing a scroll message. |
| 523 TimeDelta delta = TimeTicks::Now() - scroll_start; | 523 TimeDelta delta = TimeTicks::Now() - scroll_start; |
| 524 UMA_HISTOGRAM_TIMES(L"MPArch.RWH_OnMsgScrollRect", delta); | 524 UMA_HISTOGRAM_TIMES("MPArch.RWH_OnMsgScrollRect", delta); |
| 525 } | 525 } |
| 526 | 526 |
| 527 void RenderWidgetHost::OnMsgInputEventAck(const IPC::Message& message) { | 527 void RenderWidgetHost::OnMsgInputEventAck(const IPC::Message& message) { |
| 528 // Log the time delta for processing an input event. | 528 // Log the time delta for processing an input event. |
| 529 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; | 529 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; |
| 530 UMA_HISTOGRAM_TIMES(L"MPArch.RWH_InputEventDelta", delta); | 530 UMA_HISTOGRAM_TIMES("MPArch.RWH_InputEventDelta", delta); |
| 531 | 531 |
| 532 // Cancel pending hung renderer checks since the renderer is responsive. | 532 // Cancel pending hung renderer checks since the renderer is responsive. |
| 533 StopHangMonitorTimeout(); | 533 StopHangMonitorTimeout(); |
| 534 | 534 |
| 535 void* iter = NULL; | 535 void* iter = NULL; |
| 536 int type = 0; | 536 int type = 0; |
| 537 bool r = message.ReadInt(&iter, &type); | 537 bool r = message.ReadInt(&iter, &type); |
| 538 DCHECK(r); | 538 DCHECK(r); |
| 539 | 539 |
| 540 if (type == WebInputEvent::MOUSE_MOVE) { | 540 if (type == WebInputEvent::MOUSE_MOVE) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 | 625 |
| 626 // TODO(darin): do we need to do something else if our backing store is not | 626 // 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 | 627 // the same size as the advertised view? maybe we just assume there is a |
| 628 // full paint on its way? | 628 // full paint on its way? |
| 629 BackingStore* backing_store = BackingStoreManager::Lookup(this); | 629 BackingStore* backing_store = BackingStoreManager::Lookup(this); |
| 630 if (!backing_store || (backing_store->size() != view_size)) | 630 if (!backing_store || (backing_store->size() != view_size)) |
| 631 return; | 631 return; |
| 632 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, | 632 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, |
| 633 dx, dy, clip_rect, view_size); | 633 dx, dy, clip_rect, view_size); |
| 634 } | 634 } |
| OLD | NEW |