OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 IPC_BEGIN_MESSAGE_MAP_EX(RenderWidgetHostImpl, msg, msg_is_ok) | 474 IPC_BEGIN_MESSAGE_MAP_EX(RenderWidgetHostImpl, msg, msg_is_ok) |
475 IPC_MESSAGE_HANDLER(InputHostMsg_QueueSyntheticGesture, | 475 IPC_MESSAGE_HANDLER(InputHostMsg_QueueSyntheticGesture, |
476 OnQueueSyntheticGesture) | 476 OnQueueSyntheticGesture) |
477 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) | 477 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) |
478 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderProcessGone, OnRenderProcessGone) | 478 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderProcessGone, OnRenderProcessGone) |
479 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) | 479 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) |
480 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateScreenRects_ACK, | 480 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateScreenRects_ACK, |
481 OnUpdateScreenRectsAck) | 481 OnUpdateScreenRectsAck) |
482 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) | 482 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) |
483 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnSetTooltipText) | 483 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnSetTooltipText) |
484 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnPaintAtSizeAck) | |
485 #if defined(OS_MACOSX) | 484 #if defined(OS_MACOSX) |
486 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped, | 485 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped, |
487 OnCompositorSurfaceBuffersSwapped) | 486 OnCompositorSurfaceBuffersSwapped) |
488 #endif | 487 #endif |
489 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, | 488 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, |
490 msg_is_ok = OnSwapCompositorFrame(msg)) | 489 msg_is_ok = OnSwapCompositorFrame(msg)) |
491 IPC_MESSAGE_HANDLER(ViewHostMsg_DidOverscroll, OnOverscrolled) | 490 IPC_MESSAGE_HANDLER(ViewHostMsg_DidOverscroll, OnOverscrolled) |
492 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopFlinging, OnFlingingStopped) | 491 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopFlinging, OnFlingingStopped) |
493 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) | 492 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) |
494 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnUpdateIsDelayed) | 493 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnUpdateIsDelayed) |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 const CGRect& dest_rect, CGContextRef target) { | 768 const CGRect& dest_rect, CGContextRef target) { |
770 BackingStore* backing_store = GetBackingStore(false); | 769 BackingStore* backing_store = GetBackingStore(false); |
771 if (!backing_store) | 770 if (!backing_store) |
772 return false; | 771 return false; |
773 (static_cast<BackingStoreMac*>(backing_store))-> | 772 (static_cast<BackingStoreMac*>(backing_store))-> |
774 CopyFromBackingStoreToCGContext(dest_rect, target); | 773 CopyFromBackingStoreToCGContext(dest_rect, target); |
775 return true; | 774 return true; |
776 } | 775 } |
777 #endif | 776 #endif |
778 | 777 |
779 void RenderWidgetHostImpl::PaintAtSize(TransportDIB::Handle dib_handle, | |
780 int tag, | |
781 const gfx::Size& page_size, | |
782 const gfx::Size& desired_size) { | |
783 // Ask the renderer to create a bitmap regardless of whether it's | |
784 // hidden, being resized, redrawn, etc. It resizes the web widget | |
785 // to the page_size and then scales it to the desired_size. | |
786 Send(new ViewMsg_PaintAtSize(routing_id_, dib_handle, tag, | |
787 page_size, desired_size)); | |
788 } | |
789 | |
790 bool RenderWidgetHostImpl::TryGetBackingStore(const gfx::Size& desired_size, | 778 bool RenderWidgetHostImpl::TryGetBackingStore(const gfx::Size& desired_size, |
791 BackingStore** backing_store) { | 779 BackingStore** backing_store) { |
792 // Check if the view has an accelerated surface of the desired size. | 780 // Check if the view has an accelerated surface of the desired size. |
793 if (view_->HasAcceleratedSurface(desired_size)) { | 781 if (view_->HasAcceleratedSurface(desired_size)) { |
794 *backing_store = NULL; | 782 *backing_store = NULL; |
795 return true; | 783 return true; |
796 } | 784 } |
797 | 785 |
798 // Check for a software backing store of the desired size. | 786 // Check for a software backing store of the desired size. |
799 *backing_store = BackingStoreManager::GetBackingStore(this, desired_size); | 787 *backing_store = BackingStoreManager::GetBackingStore(this, desired_size); |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1479 SendScreenRects(); | 1467 SendScreenRects(); |
1480 } | 1468 } |
1481 | 1469 |
1482 void RenderWidgetHostImpl::OnRequestMove(const gfx::Rect& pos) { | 1470 void RenderWidgetHostImpl::OnRequestMove(const gfx::Rect& pos) { |
1483 if (view_) { | 1471 if (view_) { |
1484 view_->SetBounds(pos); | 1472 view_->SetBounds(pos); |
1485 Send(new ViewMsg_Move_ACK(routing_id_)); | 1473 Send(new ViewMsg_Move_ACK(routing_id_)); |
1486 } | 1474 } |
1487 } | 1475 } |
1488 | 1476 |
1489 void RenderWidgetHostImpl::OnPaintAtSizeAck(int tag, const gfx::Size& size) { | |
1490 std::pair<int, gfx::Size> details = std::make_pair(tag, size); | |
1491 NotificationService::current()->Notify( | |
1492 NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, | |
1493 Source<RenderWidgetHost>(this), | |
1494 Details<std::pair<int, gfx::Size> >(&details)); | |
1495 } | |
1496 | |
1497 #if defined(OS_MACOSX) | 1477 #if defined(OS_MACOSX) |
1498 void RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped( | 1478 void RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped( |
1499 const ViewHostMsg_CompositorSurfaceBuffersSwapped_Params& params) { | 1479 const ViewHostMsg_CompositorSurfaceBuffersSwapped_Params& params) { |
1500 TRACE_EVENT0("renderer_host", | 1480 TRACE_EVENT0("renderer_host", |
1501 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped"); | 1481 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped"); |
1502 if (!ui::LatencyInfo::Verify(params.latency_info, | 1482 if (!ui::LatencyInfo::Verify(params.latency_info, |
1503 "ViewHostMsg_CompositorSurfaceBuffersSwapped")) | 1483 "ViewHostMsg_CompositorSurfaceBuffersSwapped")) |
1504 return; | 1484 return; |
1505 if (!view_) { | 1485 if (!view_) { |
1506 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 1486 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2549 } | 2529 } |
2550 } | 2530 } |
2551 | 2531 |
2552 // Add newly generated components into the latency info | 2532 // Add newly generated components into the latency info |
2553 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { | 2533 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { |
2554 latency_info->latency_components[lc->first] = lc->second; | 2534 latency_info->latency_components[lc->first] = lc->second; |
2555 } | 2535 } |
2556 } | 2536 } |
2557 | 2537 |
2558 } // namespace content | 2538 } // namespace content |
OLD | NEW |