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 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
780 int tag, | 780 int tag, |
781 const gfx::Size& page_size, | 781 const gfx::Size& page_size, |
782 const gfx::Size& desired_size) { | 782 const gfx::Size& desired_size) { |
783 // Ask the renderer to create a bitmap regardless of whether it's | 783 // Ask the renderer to create a bitmap regardless of whether it's |
784 // hidden, being resized, redrawn, etc. It resizes the web widget | 784 // hidden, being resized, redrawn, etc. It resizes the web widget |
785 // to the page_size and then scales it to the desired_size. | 785 // to the page_size and then scales it to the desired_size. |
786 Send(new ViewMsg_PaintAtSize(routing_id_, dib_handle, tag, | 786 Send(new ViewMsg_PaintAtSize(routing_id_, dib_handle, tag, |
787 page_size, desired_size)); | 787 page_size, desired_size)); |
788 } | 788 } |
789 | 789 |
790 void RenderWidgetHostImpl::SetAboutToWaitForBackingStoreCallback( | |
791 const base::Closure& about_to_wait_for_backing_store_callback) { | |
792 about_to_wait_for_backing_store_callback_ = | |
793 about_to_wait_for_backing_store_callback; | |
794 } | |
795 | |
790 bool RenderWidgetHostImpl::TryGetBackingStore(const gfx::Size& desired_size, | 796 bool RenderWidgetHostImpl::TryGetBackingStore(const gfx::Size& desired_size, |
791 BackingStore** backing_store) { | 797 BackingStore** backing_store) { |
792 // Check if the view has an accelerated surface of the desired size. | 798 // Check if the view has an accelerated surface of the desired size. |
793 if (view_->HasAcceleratedSurface(desired_size)) { | 799 if (view_->HasAcceleratedSurface(desired_size)) { |
794 *backing_store = NULL; | 800 *backing_store = NULL; |
795 return true; | 801 return true; |
796 } | 802 } |
797 | 803 |
798 // Check for a software backing store of the desired size. | 804 // Check for a software backing store of the desired size. |
799 *backing_store = BackingStoreManager::GetBackingStore(this, desired_size); | 805 *backing_store = BackingStoreManager::GetBackingStore(this, desired_size); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
849 TRACE_EVENT_ASYNC_BEGIN0( | 855 TRACE_EVENT_ASYNC_BEGIN0( |
850 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this); | 856 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this); |
851 Send(new ViewMsg_Repaint(routing_id_, view_size)); | 857 Send(new ViewMsg_Repaint(routing_id_, view_size)); |
852 } | 858 } |
853 | 859 |
854 TimeDelta max_delay = TimeDelta::FromMilliseconds(kPaintMsgTimeoutMS); | 860 TimeDelta max_delay = TimeDelta::FromMilliseconds(kPaintMsgTimeoutMS); |
855 TimeTicks end_time = TimeTicks::Now() + max_delay; | 861 TimeTicks end_time = TimeTicks::Now() + max_delay; |
856 do { | 862 do { |
857 TRACE_EVENT0("renderer_host", "GetBackingStore::WaitForUpdate"); | 863 TRACE_EVENT0("renderer_host", "GetBackingStore::WaitForUpdate"); |
858 | 864 |
865 // Release any backpressure preventing the renderer from generating new | |
866 // frames. | |
867 if (!about_to_wait_for_backing_store_callback_.is_null()) | |
868 about_to_wait_for_backing_store_callback_.Run(); | |
ccameron
2014/02/14 02:19:06
The call that we need it before is this guy. It's
piman
2014/02/14 02:59:02
RWHVMac could send the ack right away when receivi
| |
869 | |
859 // When we have asked the RenderWidget to resize, and we are still waiting | 870 // When we have asked the RenderWidget to resize, and we are still waiting |
860 // on a response, block for a little while to see if we can't get a response | 871 // on a response, block for a little while to see if we can't get a response |
861 // before returning the old (incorrectly sized) backing store. | 872 // before returning the old (incorrectly sized) backing store. |
862 IPC::Message msg; | 873 IPC::Message msg; |
863 if (process_->WaitForBackingStoreMsg(routing_id_, max_delay, &msg)) { | 874 if (process_->WaitForBackingStoreMsg(routing_id_, max_delay, &msg)) { |
864 OnMessageReceived(msg); | 875 OnMessageReceived(msg); |
865 | 876 |
866 // For auto-resized views, current_size_ determines the view_size and it | 877 // For auto-resized views, current_size_ determines the view_size and it |
867 // may have changed during the handling of an UpdateRect message. | 878 // may have changed during the handling of an UpdateRect message. |
868 if (should_auto_resize_) | 879 if (should_auto_resize_) |
(...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2549 } | 2560 } |
2550 } | 2561 } |
2551 | 2562 |
2552 // Add newly generated components into the latency info | 2563 // Add newly generated components into the latency info |
2553 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { | 2564 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { |
2554 latency_info->latency_components[lc->first] = lc->second; | 2565 latency_info->latency_components[lc->first] = lc->second; |
2555 } | 2566 } |
2556 } | 2567 } |
2557 | 2568 |
2558 } // namespace content | 2569 } // namespace content |
OLD | NEW |