| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 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( | |
| 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 | |
| 81 void CompositorExternalBeginFrameSource::OnMessageReceived( | 73 void CompositorExternalBeginFrameSource::OnMessageReceived( |
| 82 const IPC::Message& message) { | 74 const IPC::Message& message) { |
| 83 DCHECK(CalledOnValidThread()); | 75 DCHECK(CalledOnValidThread()); |
| 84 DCHECK(begin_frame_source_proxy_); | 76 DCHECK(begin_frame_source_proxy_); |
| 85 IPC_BEGIN_MESSAGE_MAP(CompositorExternalBeginFrameSource, message) | 77 IPC_BEGIN_MESSAGE_MAP(CompositorExternalBeginFrameSource, message) |
| 86 IPC_MESSAGE_HANDLER(ViewMsg_SetBeginFramePaused, | 78 IPC_MESSAGE_HANDLER(ViewMsg_SetBeginFramePaused, |
| 87 OnSetBeginFrameSourcePaused) | 79 OnSetBeginFrameSourcePaused) |
| 88 IPC_MESSAGE_HANDLER(ViewMsg_BeginFrame, OnBeginFrame) | 80 IPC_MESSAGE_HANDLER(ViewMsg_BeginFrame, OnBeginFrame) |
| 89 IPC_END_MESSAGE_MAP() | 81 IPC_END_MESSAGE_MAP() |
| 90 } | 82 } |
| 91 | 83 |
| 92 void CompositorExternalBeginFrameSource::OnSetBeginFrameSourcePaused( | 84 void CompositorExternalBeginFrameSource::OnSetBeginFrameSourcePaused( |
| 93 bool paused) { | 85 bool paused) { |
| 94 external_begin_frame_source_.OnSetBeginFrameSourcePaused(paused); | 86 external_begin_frame_source_.OnSetBeginFrameSourcePaused(paused); |
| 95 } | 87 } |
| 96 | 88 |
| 97 void CompositorExternalBeginFrameSource::OnBeginFrame( | 89 void CompositorExternalBeginFrameSource::OnBeginFrame( |
| 98 const cc::BeginFrameArgs& args) { | 90 const cc::BeginFrameArgs& args) { |
| 99 external_begin_frame_source_.OnBeginFrame(args); | 91 external_begin_frame_source_.OnBeginFrame(args); |
| 100 } | 92 } |
| 101 | 93 |
| 102 bool CompositorExternalBeginFrameSource::Send(IPC::Message* message) { | 94 bool CompositorExternalBeginFrameSource::Send(IPC::Message* message) { |
| 103 return message_sender_->Send(message); | 95 return message_sender_->Send(message); |
| 104 } | 96 } |
| 105 | 97 |
| 106 } // namespace content | 98 } // namespace content |
| OLD | NEW |