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