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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 | 49 |
50 external_begin_frame_source_.AddObserver(obs); | 50 external_begin_frame_source_.AddObserver(obs); |
51 } | 51 } |
52 | 52 |
53 void CompositorExternalBeginFrameSource::RemoveObserver( | 53 void CompositorExternalBeginFrameSource::RemoveObserver( |
54 cc::BeginFrameObserver* obs) { | 54 cc::BeginFrameObserver* obs) { |
55 external_begin_frame_source_.RemoveObserver(obs); | 55 external_begin_frame_source_.RemoveObserver(obs); |
56 } | 56 } |
57 | 57 |
| 58 void CompositorExternalBeginFrameSource::DidFinishFrame( |
| 59 cc::BeginFrameObserver* obs, |
| 60 const cc::BeginFrameAck& ack) { |
| 61 external_begin_frame_source_.DidFinishFrame(obs, ack); |
| 62 } |
| 63 |
58 bool CompositorExternalBeginFrameSource::IsThrottled() const { | 64 bool CompositorExternalBeginFrameSource::IsThrottled() const { |
59 return true; | 65 return true; |
60 } | 66 } |
61 | 67 |
62 void CompositorExternalBeginFrameSource::OnNeedsBeginFrames( | 68 void CompositorExternalBeginFrameSource::OnNeedsBeginFrames( |
63 bool needs_begin_frames) { | 69 bool needs_begin_frames) { |
64 Send(new ViewHostMsg_SetNeedsBeginFrames(routing_id_, needs_begin_frames)); | 70 Send(new ViewHostMsg_SetNeedsBeginFrames(routing_id_, needs_begin_frames)); |
65 } | 71 } |
66 | 72 |
67 void CompositorExternalBeginFrameSource::OnDidFinishFrame( | 73 void CompositorExternalBeginFrameSource::OnDidFinishFrame( |
68 const cc::BeginFrameAck& ack) { | 74 const cc::BeginFrameAck& ack) { |
69 // TODO(eseckler): Pass on the ack to the view host. | 75 // If there was damage, ViewHostMsg_SwapCompositorFrame includes the ack. |
| 76 if (!ack.has_damage) |
| 77 Send(new ViewHostMsg_BeginFrameDidNotSwap(routing_id_, ack)); |
70 } | 78 } |
71 | 79 |
72 void CompositorExternalBeginFrameSource::OnMessageReceived( | 80 void CompositorExternalBeginFrameSource::OnMessageReceived( |
73 const IPC::Message& message) { | 81 const IPC::Message& message) { |
74 DCHECK(CalledOnValidThread()); | 82 DCHECK(CalledOnValidThread()); |
75 DCHECK(begin_frame_source_proxy_); | 83 DCHECK(begin_frame_source_proxy_); |
76 IPC_BEGIN_MESSAGE_MAP(CompositorExternalBeginFrameSource, message) | 84 IPC_BEGIN_MESSAGE_MAP(CompositorExternalBeginFrameSource, message) |
77 IPC_MESSAGE_HANDLER(ViewMsg_SetBeginFramePaused, | 85 IPC_MESSAGE_HANDLER(ViewMsg_SetBeginFramePaused, |
78 OnSetBeginFrameSourcePaused) | 86 OnSetBeginFrameSourcePaused) |
79 IPC_MESSAGE_HANDLER(ViewMsg_BeginFrame, OnBeginFrame) | 87 IPC_MESSAGE_HANDLER(ViewMsg_BeginFrame, OnBeginFrame) |
80 IPC_END_MESSAGE_MAP() | 88 IPC_END_MESSAGE_MAP() |
81 } | 89 } |
82 | 90 |
83 void CompositorExternalBeginFrameSource::OnSetBeginFrameSourcePaused( | 91 void CompositorExternalBeginFrameSource::OnSetBeginFrameSourcePaused( |
84 bool paused) { | 92 bool paused) { |
85 external_begin_frame_source_.OnSetBeginFrameSourcePaused(paused); | 93 external_begin_frame_source_.OnSetBeginFrameSourcePaused(paused); |
86 } | 94 } |
87 | 95 |
88 void CompositorExternalBeginFrameSource::OnBeginFrame( | 96 void CompositorExternalBeginFrameSource::OnBeginFrame( |
89 const cc::BeginFrameArgs& args) { | 97 const cc::BeginFrameArgs& args) { |
90 external_begin_frame_source_.OnBeginFrame(args); | 98 external_begin_frame_source_.OnBeginFrame(args); |
91 } | 99 } |
92 | 100 |
93 bool CompositorExternalBeginFrameSource::Send(IPC::Message* message) { | 101 bool CompositorExternalBeginFrameSource::Send(IPC::Message* message) { |
94 return message_sender_->Send(message); | 102 return message_sender_->Send(message); |
95 } | 103 } |
96 | 104 |
97 } // namespace content | 105 } // namespace content |
OLD | NEW |