| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/compositor_external_begin_frame_source.h" | 5 #include "content/renderer/gpu/compositor_external_begin_frame_source.h" |
| 6 | 6 |
| 7 #include "content/common/view_messages.h" | 7 #include "content/common/view_messages.h" |
| 8 #include "ipc/ipc_sync_channel.h" | 8 #include "ipc/ipc_sync_channel.h" |
| 9 #include "ipc/ipc_sync_message_filter.h" | 9 #include "ipc/ipc_sync_message_filter.h" |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 bool CompositorExternalBeginFrameSource::IsThrottled() const { | 64 bool CompositorExternalBeginFrameSource::IsThrottled() const { |
| 65 return true; | 65 return true; |
| 66 } | 66 } |
| 67 | 67 |
| 68 void CompositorExternalBeginFrameSource::OnNeedsBeginFrames( | 68 void CompositorExternalBeginFrameSource::OnNeedsBeginFrames( |
| 69 bool needs_begin_frames) { | 69 bool needs_begin_frames) { |
| 70 Send(new ViewHostMsg_SetNeedsBeginFrames(routing_id_, needs_begin_frames)); | 70 Send(new ViewHostMsg_SetNeedsBeginFrames(routing_id_, needs_begin_frames)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void CompositorExternalBeginFrameSource::OnDidFinishFrame( | 73 void CompositorExternalBeginFrameSource::OnDidFinishFrame( |
| 74 const cc::BeginFrameAck& ack) { | 74 const cc::BeginFrameAck& ack) {} |
| 75 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, ack.sequence_number); | |
| 76 // If there was damage, ViewHostMsg_SwapCompositorFrame includes the ack. | |
| 77 if (!ack.has_damage) | |
| 78 Send(new ViewHostMsg_BeginFrameDidNotSwap(routing_id_, ack)); | |
| 79 } | |
| 80 | 75 |
| 81 void CompositorExternalBeginFrameSource::OnMessageReceived( | 76 void CompositorExternalBeginFrameSource::OnMessageReceived( |
| 82 const IPC::Message& message) { | 77 const IPC::Message& message) { |
| 83 DCHECK(CalledOnValidThread()); | 78 DCHECK(CalledOnValidThread()); |
| 84 DCHECK(begin_frame_source_proxy_); | 79 DCHECK(begin_frame_source_proxy_); |
| 85 IPC_BEGIN_MESSAGE_MAP(CompositorExternalBeginFrameSource, message) | 80 IPC_BEGIN_MESSAGE_MAP(CompositorExternalBeginFrameSource, message) |
| 86 IPC_MESSAGE_HANDLER(ViewMsg_SetBeginFramePaused, | 81 IPC_MESSAGE_HANDLER(ViewMsg_SetBeginFramePaused, |
| 87 OnSetBeginFrameSourcePaused) | 82 OnSetBeginFrameSourcePaused) |
| 88 IPC_MESSAGE_HANDLER(ViewMsg_BeginFrame, OnBeginFrame) | 83 IPC_MESSAGE_HANDLER(ViewMsg_BeginFrame, OnBeginFrame) |
| 89 IPC_END_MESSAGE_MAP() | 84 IPC_END_MESSAGE_MAP() |
| 90 } | 85 } |
| 91 | 86 |
| 92 void CompositorExternalBeginFrameSource::OnSetBeginFrameSourcePaused( | 87 void CompositorExternalBeginFrameSource::OnSetBeginFrameSourcePaused( |
| 93 bool paused) { | 88 bool paused) { |
| 94 external_begin_frame_source_.OnSetBeginFrameSourcePaused(paused); | 89 external_begin_frame_source_.OnSetBeginFrameSourcePaused(paused); |
| 95 } | 90 } |
| 96 | 91 |
| 97 void CompositorExternalBeginFrameSource::OnBeginFrame( | 92 void CompositorExternalBeginFrameSource::OnBeginFrame( |
| 98 const cc::BeginFrameArgs& args) { | 93 const cc::BeginFrameArgs& args) { |
| 99 external_begin_frame_source_.OnBeginFrame(args); | 94 external_begin_frame_source_.OnBeginFrame(args); |
| 100 } | 95 } |
| 101 | 96 |
| 102 bool CompositorExternalBeginFrameSource::Send(IPC::Message* message) { | 97 bool CompositorExternalBeginFrameSource::Send(IPC::Message* message) { |
| 103 return message_sender_->Send(message); | 98 return message_sender_->Send(message); |
| 104 } | 99 } |
| 105 | 100 |
| 106 } // namespace content | 101 } // namespace content |
| OLD | NEW |