| 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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/debug/trace_event_synthetic_delay.h" | 10 #include "base/debug/trace_event_synthetic_delay.h" |
| (...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1860 } | 1860 } |
| 1861 } | 1861 } |
| 1862 | 1862 |
| 1863 void RenderWidget::AutoResizeCompositor() { | 1863 void RenderWidget::AutoResizeCompositor() { |
| 1864 physical_backing_size_ = gfx::ToCeiledSize(gfx::ScaleSize(size_, | 1864 physical_backing_size_ = gfx::ToCeiledSize(gfx::ScaleSize(size_, |
| 1865 device_scale_factor_)); | 1865 device_scale_factor_)); |
| 1866 if (compositor_) | 1866 if (compositor_) |
| 1867 compositor_->setViewportSize(size_, physical_backing_size_); | 1867 compositor_->setViewportSize(size_, physical_backing_size_); |
| 1868 } | 1868 } |
| 1869 | 1869 |
| 1870 // FIXME: To be removed as soon as chromium and blink side changes land | |
| 1871 // didActivateCompositor with parameters is still kept in order to land | |
| 1872 // these changes s-chromium - https://codereview.chromium.org/137893025/. | |
| 1873 // s-blink - https://codereview.chromium.org/138523003/ | |
| 1874 void RenderWidget::didActivateCompositor(int input_handler_identifier) { | |
| 1875 TRACE_EVENT0("gpu", "RenderWidget::didActivateCompositor"); | |
| 1876 | |
| 1877 #if !defined(OS_MACOSX) | |
| 1878 if (!is_accelerated_compositing_active_) { | |
| 1879 // When not in accelerated compositing mode, in certain cases (e.g. waiting | |
| 1880 // for a resize or if no backing store) the RenderWidgetHost is blocking the | |
| 1881 // browser's UI thread for some time, waiting for an UpdateRect. If we are | |
| 1882 // going to switch to accelerated compositing, the GPU process may need | |
| 1883 // round-trips to the browser's UI thread before finishing the frame, | |
| 1884 // causing deadlocks if we delay the UpdateRect until we receive the | |
| 1885 // OnSwapBuffersComplete. So send a dummy message that will unblock the | |
| 1886 // browser's UI thread. This is not necessary on Mac, because SwapBuffers | |
| 1887 // now unblocks GetBackingStore on Mac. | |
| 1888 Send(new ViewHostMsg_UpdateIsDelayed(routing_id_)); | |
| 1889 } | |
| 1890 #endif | |
| 1891 | |
| 1892 is_accelerated_compositing_active_ = true; | |
| 1893 Send(new ViewHostMsg_DidActivateAcceleratedCompositing( | |
| 1894 routing_id_, is_accelerated_compositing_active_)); | |
| 1895 | |
| 1896 if (!was_accelerated_compositing_ever_active_) { | |
| 1897 was_accelerated_compositing_ever_active_ = true; | |
| 1898 webwidget_->enterForceCompositingMode(true); | |
| 1899 } | |
| 1900 } | |
| 1901 | |
| 1902 void RenderWidget::didActivateCompositor() { | 1870 void RenderWidget::didActivateCompositor() { |
| 1903 TRACE_EVENT0("gpu", "RenderWidget::didActivateCompositor"); | 1871 TRACE_EVENT0("gpu", "RenderWidget::didActivateCompositor"); |
| 1904 | 1872 |
| 1905 #if !defined(OS_MACOSX) | 1873 #if !defined(OS_MACOSX) |
| 1906 if (!is_accelerated_compositing_active_) { | 1874 if (!is_accelerated_compositing_active_) { |
| 1907 // When not in accelerated compositing mode, in certain cases (e.g. waiting | 1875 // When not in accelerated compositing mode, in certain cases (e.g. waiting |
| 1908 // for a resize or if no backing store) the RenderWidgetHost is blocking the | 1876 // for a resize or if no backing store) the RenderWidgetHost is blocking the |
| 1909 // browser's UI thread for some time, waiting for an UpdateRect. If we are | 1877 // browser's UI thread for some time, waiting for an UpdateRect. If we are |
| 1910 // going to switch to accelerated compositing, the GPU process may need | 1878 // going to switch to accelerated compositing, the GPU process may need |
| 1911 // round-trips to the browser's UI thread before finishing the frame, | 1879 // round-trips to the browser's UI thread before finishing the frame, |
| (...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2889 | 2857 |
| 2890 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { | 2858 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { |
| 2891 swapped_out_frames_.AddObserver(frame); | 2859 swapped_out_frames_.AddObserver(frame); |
| 2892 } | 2860 } |
| 2893 | 2861 |
| 2894 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { | 2862 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { |
| 2895 swapped_out_frames_.RemoveObserver(frame); | 2863 swapped_out_frames_.RemoveObserver(frame); |
| 2896 } | 2864 } |
| 2897 | 2865 |
| 2898 } // namespace content | 2866 } // namespace content |
| OLD | NEW |