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 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1336 void RenderWidget::didBecomeReadyForAdditionalInput() { | 1336 void RenderWidget::didBecomeReadyForAdditionalInput() { |
1337 TRACE_EVENT0("renderer", "RenderWidget::didBecomeReadyForAdditionalInput"); | 1337 TRACE_EVENT0("renderer", "RenderWidget::didBecomeReadyForAdditionalInput"); |
1338 FlushPendingInputEventAck(); | 1338 FlushPendingInputEventAck(); |
1339 } | 1339 } |
1340 | 1340 |
1341 void RenderWidget::DidCommitCompositorFrame() { | 1341 void RenderWidget::DidCommitCompositorFrame() { |
1342 FOR_EACH_OBSERVER(RenderFrameImpl, swapped_out_frames_, | 1342 FOR_EACH_OBSERVER(RenderFrameImpl, swapped_out_frames_, |
1343 DidCommitCompositorFrame()); | 1343 DidCommitCompositorFrame()); |
1344 } | 1344 } |
1345 | 1345 |
1346 namespace { | |
1347 | |
1348 class RWSwapPromise: public cc::SwapPromise { | |
1349 public: | |
1350 RWSwapPromise(IPC::Sender* sender, int routing_id, IPC::Message msg): | |
1351 fallback_sender_(sender), | |
1352 fallback_routing_id_(routing_id), | |
1353 msg_(msg) {} | |
1354 virtual void DidSwap(cc::CompositorFrameMetadata* metadata) OVERRIDE { | |
1355 metadata->payload.push_back(msg); | |
1356 } | |
1357 virtual void DidNotSwap(DidNotSwapReason reason) OVERRIDE { | |
1358 fallback_sender_->Send( | |
1359 new ViewHostMsg_DeliverPayload(fallback_routing_id_, msg)); | |
piman
2014/05/07 01:21:46
How about fallback_sender_->Send(msg)? Is there a
piman
2014/05/07 01:21:46
Also, beware, DidNotSwap can be called on either t
mkosiba (inactive)
2014/05/07 18:27:20
thanks for pointing that out!
| |
1360 } | |
1361 private: | |
1362 IPC::Sender* fallback_sender_; | |
1363 int fallback_routing_id_; | |
1364 IPC::Message msg_; | |
1365 }; | |
1366 | |
1367 } // namespace | |
1368 | |
1369 void RenderWidget::QueueMessage(const IPC::Message& msg) { | |
mkosiba (inactive)
2014/05/06 22:30:33
so this would be the entry point
| |
1370 if (!compositor_->commitRequested()) { | |
piman
2014/05/07 01:21:46
I'm not sure if that isn't racy.
I think the cont
mkosiba (inactive)
2014/05/07 18:27:20
oh.. I assumed that this tracks whether the Blink
| |
1371 Send(ViewHostMsg_DeliverPayload(routing_id_, msg); | |
1372 } else { | |
1373 scoped_ptr<cc::SwapPromise> promise(new RWSwapPromise()); | |
1374 compositor_->QueueSwapPromise(promise.Pass()); | |
1375 } | |
1376 } | |
1377 | |
1346 void RenderWidget::didCommitAndDrawCompositorFrame() { | 1378 void RenderWidget::didCommitAndDrawCompositorFrame() { |
1347 TRACE_EVENT0("gpu", "RenderWidget::didCommitAndDrawCompositorFrame"); | 1379 TRACE_EVENT0("gpu", "RenderWidget::didCommitAndDrawCompositorFrame"); |
1348 // Accelerated FPS tick for performance tests. See | 1380 // Accelerated FPS tick for performance tests. See |
1349 // tab_capture_performancetest.cc. NOTE: Tests may break if this event is | 1381 // tab_capture_performancetest.cc. NOTE: Tests may break if this event is |
1350 // renamed or moved. | 1382 // renamed or moved. |
1351 UNSHIPPED_TRACE_EVENT_INSTANT0("test_fps", "TestFrameTickGPU", | 1383 UNSHIPPED_TRACE_EVENT_INSTANT0("test_fps", "TestFrameTickGPU", |
1352 TRACE_EVENT_SCOPE_THREAD); | 1384 TRACE_EVENT_SCOPE_THREAD); |
1353 // Notify subclasses that we initiated the paint operation. | 1385 // Notify subclasses that we initiated the paint operation. |
1354 DidInitiatePaint(); | 1386 DidInitiatePaint(); |
1355 } | 1387 } |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2228 | 2260 |
2229 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { | 2261 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { |
2230 swapped_out_frames_.AddObserver(frame); | 2262 swapped_out_frames_.AddObserver(frame); |
2231 } | 2263 } |
2232 | 2264 |
2233 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { | 2265 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { |
2234 swapped_out_frames_.RemoveObserver(frame); | 2266 swapped_out_frames_.RemoveObserver(frame); |
2235 } | 2267 } |
2236 | 2268 |
2237 } // namespace content | 2269 } // namespace content |
OLD | NEW |