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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 std::unique_ptr<cc::CopyOutputRequest> request = | 942 std::unique_ptr<cc::CopyOutputRequest> request = |
943 cc::CopyOutputRequest::CreateBitmapRequest(base::Bind( | 943 cc::CopyOutputRequest::CreateBitmapRequest(base::Bind( |
944 [](blink::WebCompositeAndReadbackAsyncCallback* callback, | 944 [](blink::WebCompositeAndReadbackAsyncCallback* callback, |
945 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 945 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
946 std::unique_ptr<cc::CopyOutputResult> result) { | 946 std::unique_ptr<cc::CopyOutputResult> result) { |
947 task_runner->PostTask(FROM_HERE, | 947 task_runner->PostTask(FROM_HERE, |
948 base::Bind(&CompositeAndReadbackAsyncCallback, | 948 base::Bind(&CompositeAndReadbackAsyncCallback, |
949 callback, base::Passed(&result))); | 949 callback, base::Passed(&result))); |
950 }, | 950 }, |
951 callback, base::Passed(&main_thread_task_runner))); | 951 callback, base::Passed(&main_thread_task_runner))); |
| 952 // Force a redraw to ensure that the copy swap promise isn't cancelled due to |
| 953 // no damage. |
| 954 SetNeedsForcedRedraw(); |
952 layer_tree_host_->QueueSwapPromise( | 955 layer_tree_host_->QueueSwapPromise( |
953 delegate_->RequestCopyOfOutputForLayoutTest(std::move(request))); | 956 delegate_->RequestCopyOfOutputForLayoutTest(std::move(request))); |
954 | 957 |
955 // Force a commit to happen. The temporary copy output request will | 958 // Force a commit to happen. The temporary copy output request will |
956 // be installed after layout which will happen as a part of the commit, for | 959 // be installed after layout which will happen as a part of the commit, for |
957 // widgets that delay the creation of their output surface. | 960 // widgets that delay the creation of their output surface. |
958 if (CompositeIsSynchronous()) { | 961 if (CompositeIsSynchronous()) { |
959 base::ThreadTaskRunnerHandle::Get()->PostTask( | 962 base::ThreadTaskRunnerHandle::Get()->PostTask( |
960 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, | 963 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, |
961 weak_factory_.GetWeakPtr())); | 964 weak_factory_.GetWeakPtr())); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 void RenderWidgetCompositor::SetContentSourceId(uint32_t id) { | 1156 void RenderWidgetCompositor::SetContentSourceId(uint32_t id) { |
1154 layer_tree_host_->SetContentSourceId(id); | 1157 layer_tree_host_->SetContentSourceId(id); |
1155 } | 1158 } |
1156 | 1159 |
1157 void RenderWidgetCompositor::SetLocalSurfaceId( | 1160 void RenderWidgetCompositor::SetLocalSurfaceId( |
1158 const cc::LocalSurfaceId& local_surface_id) { | 1161 const cc::LocalSurfaceId& local_surface_id) { |
1159 layer_tree_host_->SetLocalSurfaceId(local_surface_id); | 1162 layer_tree_host_->SetLocalSurfaceId(local_surface_id); |
1160 } | 1163 } |
1161 | 1164 |
1162 } // namespace content | 1165 } // namespace content |
OLD | NEW |