Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: content/renderer/gpu/compositor_external_begin_frame_source.cc

Issue 2527283003: cc: Introduce BeginFrame sequence numbers and acknowledgements.
Patch Set: Address Brian's comments. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
73 void CompositorExternalBeginFrameSource::OnDidFinishFrame(
74 const cc::BeginFrameAck& ack) {
75 // If there was damage, SwapCompositorFrame serves as ack.
76 if (!ack.has_damage)
77 Send(new ViewHostMsg_BeginFrameDidNotDraw(routing_id_, ack));
78 }
79
67 void CompositorExternalBeginFrameSource::OnMessageReceived( 80 void CompositorExternalBeginFrameSource::OnMessageReceived(
68 const IPC::Message& message) { 81 const IPC::Message& message) {
69 DCHECK(CalledOnValidThread()); 82 DCHECK(CalledOnValidThread());
70 DCHECK(begin_frame_source_proxy_); 83 DCHECK(begin_frame_source_proxy_);
71 IPC_BEGIN_MESSAGE_MAP(CompositorExternalBeginFrameSource, message) 84 IPC_BEGIN_MESSAGE_MAP(CompositorExternalBeginFrameSource, message)
72 IPC_MESSAGE_HANDLER(ViewMsg_SetBeginFramePaused, 85 IPC_MESSAGE_HANDLER(ViewMsg_SetBeginFramePaused,
73 OnSetBeginFrameSourcePaused) 86 OnSetBeginFrameSourcePaused)
74 IPC_MESSAGE_HANDLER(ViewMsg_BeginFrame, OnBeginFrame) 87 IPC_MESSAGE_HANDLER(ViewMsg_BeginFrame, OnBeginFrame)
75 IPC_END_MESSAGE_MAP() 88 IPC_END_MESSAGE_MAP()
76 } 89 }
77 90
78 void CompositorExternalBeginFrameSource::OnSetBeginFrameSourcePaused( 91 void CompositorExternalBeginFrameSource::OnSetBeginFrameSourcePaused(
79 bool paused) { 92 bool paused) {
80 external_begin_frame_source_.OnSetBeginFrameSourcePaused(paused); 93 external_begin_frame_source_.OnSetBeginFrameSourcePaused(paused);
81 } 94 }
82 95
83 void CompositorExternalBeginFrameSource::OnBeginFrame( 96 void CompositorExternalBeginFrameSource::OnBeginFrame(
84 const cc::BeginFrameArgs& args) { 97 const cc::BeginFrameArgs& args) {
85 external_begin_frame_source_.OnBeginFrame(args); 98 external_begin_frame_source_.OnBeginFrame(args);
86 } 99 }
87 100
88 bool CompositorExternalBeginFrameSource::Send(IPC::Message* message) { 101 bool CompositorExternalBeginFrameSource::Send(IPC::Message* message) {
89 return message_sender_->Send(message); 102 return message_sender_->Send(message);
90 } 103 }
91 104
92 } // namespace content 105 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698