OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/gpu/render_widget_compositor.h" | 5 #include "content/renderer/gpu/render_widget_compositor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <limits> | 10 #include <limits> |
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 std::unique_ptr<cc::CopyOutputRequest> request = | 914 std::unique_ptr<cc::CopyOutputRequest> request = |
915 cc::CopyOutputRequest::CreateBitmapRequest(base::Bind( | 915 cc::CopyOutputRequest::CreateBitmapRequest(base::Bind( |
916 [](blink::WebCompositeAndReadbackAsyncCallback* callback, | 916 [](blink::WebCompositeAndReadbackAsyncCallback* callback, |
917 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 917 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
918 std::unique_ptr<cc::CopyOutputResult> result) { | 918 std::unique_ptr<cc::CopyOutputResult> result) { |
919 task_runner->PostTask(FROM_HERE, | 919 task_runner->PostTask(FROM_HERE, |
920 base::Bind(&CompositeAndReadbackAsyncCallback, | 920 base::Bind(&CompositeAndReadbackAsyncCallback, |
921 callback, base::Passed(&result))); | 921 callback, base::Passed(&result))); |
922 }, | 922 }, |
923 callback, base::Passed(&main_thread_task_runner))); | 923 callback, base::Passed(&main_thread_task_runner))); |
| 924 // Force a redraw to ensure that the copy swap promise isn't cancelled due to |
| 925 // no damage. |
| 926 SetNeedsForcedRedraw(); |
924 layer_tree_host_->QueueSwapPromise( | 927 layer_tree_host_->QueueSwapPromise( |
925 delegate_->RequestCopyOfOutputForLayoutTest(std::move(request))); | 928 delegate_->RequestCopyOfOutputForLayoutTest(std::move(request))); |
926 | 929 |
927 // Force a commit to happen. The temporary copy output request will | 930 // Force a commit to happen. The temporary copy output request will |
928 // be installed after layout which will happen as a part of the commit, for | 931 // be installed after layout which will happen as a part of the commit, for |
929 // widgets that delay the creation of their output surface. | 932 // widgets that delay the creation of their output surface. |
930 if (CompositeIsSynchronous()) { | 933 if (CompositeIsSynchronous()) { |
931 base::ThreadTaskRunnerHandle::Get()->PostTask( | 934 base::ThreadTaskRunnerHandle::Get()->PostTask( |
932 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, | 935 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, |
933 weak_factory_.GetWeakPtr())); | 936 weak_factory_.GetWeakPtr())); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 float device_scale) { | 1140 float device_scale) { |
1138 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); | 1141 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); |
1139 } | 1142 } |
1140 | 1143 |
1141 void RenderWidgetCompositor::SetDeviceColorSpace( | 1144 void RenderWidgetCompositor::SetDeviceColorSpace( |
1142 const gfx::ColorSpace& color_space) { | 1145 const gfx::ColorSpace& color_space) { |
1143 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); | 1146 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); |
1144 } | 1147 } |
1145 | 1148 |
1146 } // namespace content | 1149 } // namespace content |
OLD | NEW |