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/public/test/browser_test_utils.h" | 5 #include "content/public/test/browser_test_utils.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <tuple> | 8 #include <tuple> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 ->ScheduleComposite(); | 1152 ->ScheduleComposite(); |
1153 } | 1153 } |
1154 | 1154 |
1155 FrameWatcher::FrameWatcher() : MessageFilter(), frames_to_wait_(0) {} | 1155 FrameWatcher::FrameWatcher() : MessageFilter(), frames_to_wait_(0) {} |
1156 | 1156 |
1157 FrameWatcher::~FrameWatcher() { | 1157 FrameWatcher::~FrameWatcher() { |
1158 } | 1158 } |
1159 | 1159 |
1160 void FrameWatcher::ReceivedFrameSwap(cc::CompositorFrameMetadata metadata) { | 1160 void FrameWatcher::ReceivedFrameSwap(cc::CompositorFrameMetadata metadata) { |
1161 --frames_to_wait_; | 1161 --frames_to_wait_; |
1162 last_metadata_ = metadata; | 1162 last_metadata_ = std::move(metadata); |
1163 if (frames_to_wait_ == 0) | 1163 if (frames_to_wait_ == 0) |
1164 quit_.Run(); | 1164 quit_.Run(); |
1165 } | 1165 } |
1166 | 1166 |
1167 bool FrameWatcher::OnMessageReceived(const IPC::Message& message) { | 1167 bool FrameWatcher::OnMessageReceived(const IPC::Message& message) { |
1168 if (message.type() == ViewHostMsg_SwapCompositorFrame::ID) { | 1168 if (message.type() == ViewHostMsg_SwapCompositorFrame::ID) { |
1169 ViewHostMsg_SwapCompositorFrame::Param param; | 1169 ViewHostMsg_SwapCompositorFrame::Param param; |
1170 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) | 1170 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) |
1171 return false; | 1171 return false; |
1172 std::unique_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 1172 cc::CompositorFrame frame(std::move(std::get<1>(param))); |
1173 std::get<1>(param).AssignTo(frame.get()); | |
1174 | 1173 |
1175 BrowserThread::PostTask( | 1174 BrowserThread::PostTask( |
1176 BrowserThread::UI, FROM_HERE, | 1175 BrowserThread::UI, FROM_HERE, |
1177 base::Bind(&FrameWatcher::ReceivedFrameSwap, this, frame->metadata)); | 1176 base::Bind(&FrameWatcher::ReceivedFrameSwap, this, |
| 1177 base::Passed(std::move(frame.metadata)))); |
1178 } | 1178 } |
1179 return false; | 1179 return false; |
1180 } | 1180 } |
1181 | 1181 |
1182 void FrameWatcher::AttachTo(WebContents* web_contents) { | 1182 void FrameWatcher::AttachTo(WebContents* web_contents) { |
1183 DCHECK(web_contents); | 1183 DCHECK(web_contents); |
1184 RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From( | 1184 RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From( |
1185 web_contents->GetRenderViewHost()->GetWidget()); | 1185 web_contents->GetRenderViewHost()->GetWidget()); |
1186 widget_host->GetProcess()->GetChannel()->AddFilter(this); | 1186 widget_host->GetProcess()->GetChannel()->AddFilter(this); |
1187 } | 1187 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1274 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1275 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN) | 1275 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN) |
1276 return ack_result_; | 1276 return ack_result_; |
1277 base::RunLoop run_loop; | 1277 base::RunLoop run_loop; |
1278 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); | 1278 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); |
1279 run_loop.Run(); | 1279 run_loop.Run(); |
1280 return ack_result_; | 1280 return ack_result_; |
1281 } | 1281 } |
1282 | 1282 |
1283 } // namespace content | 1283 } // namespace content |
OLD | NEW |