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