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 22 matching lines...) Expand all Loading... | |
33 } | 33 } |
34 | 34 |
35 void CompositorExternalBeginFrameSource::OnNeedsBeginFramesChanged( | 35 void CompositorExternalBeginFrameSource::OnNeedsBeginFramesChanged( |
36 bool needs_begin_frames) { | 36 bool needs_begin_frames) { |
37 DCHECK(CalledOnValidThread()); | 37 DCHECK(CalledOnValidThread()); |
38 if (!needs_begin_frames) | 38 if (!needs_begin_frames) |
39 missed_begin_frame_args_ = cc::BeginFrameArgs(); | 39 missed_begin_frame_args_ = cc::BeginFrameArgs(); |
40 Send(new ViewHostMsg_SetNeedsBeginFrames(routing_id_, needs_begin_frames)); | 40 Send(new ViewHostMsg_SetNeedsBeginFrames(routing_id_, needs_begin_frames)); |
41 } | 41 } |
42 | 42 |
43 void CompositorExternalBeginFrameSource::DidFinishFrame( | |
44 cc::BeginFrameObserver* obs) { | |
45 DCHECK(CalledOnValidThread()); | |
46 SetClientReady(); | |
enne (OOO)
2016/04/14 23:02:26
Why do you need to call this? This should have alr
| |
47 // Send a MISSED begin frame if necessary. | |
enne (OOO)
2016/04/14 23:02:26
This looks like a pretty common pattern. Is there
| |
48 if (missed_begin_frame_args_.IsValid()) { | |
49 cc::BeginFrameArgs last_args = obs->LastUsedBeginFrameArgs(); | |
50 if (!last_args.IsValid() || | |
51 (missed_begin_frame_args_.frame_time > last_args.frame_time)) { | |
52 obs->OnBeginFrame(missed_begin_frame_args_); | |
53 } | |
54 } | |
55 } | |
56 | |
43 void CompositorExternalBeginFrameSource::AddObserver( | 57 void CompositorExternalBeginFrameSource::AddObserver( |
44 cc::BeginFrameObserver* obs) { | 58 cc::BeginFrameObserver* obs) { |
45 DCHECK(CalledOnValidThread()); | 59 DCHECK(CalledOnValidThread()); |
46 SetClientReady(); | 60 SetClientReady(); |
47 BeginFrameSourceBase::AddObserver(obs); | 61 BeginFrameSourceBase::AddObserver(obs); |
48 // Send a MISSED begin frame if necessary. | 62 // Send a MISSED begin frame if necessary. |
49 if (missed_begin_frame_args_.IsValid()) { | 63 if (missed_begin_frame_args_.IsValid()) { |
50 cc::BeginFrameArgs last_args = obs->LastUsedBeginFrameArgs(); | 64 cc::BeginFrameArgs last_args = obs->LastUsedBeginFrameArgs(); |
51 if (!last_args.IsValid() || | 65 if (!last_args.IsValid() || |
52 (missed_begin_frame_args_.frame_time > last_args.frame_time)) { | 66 (missed_begin_frame_args_.frame_time > last_args.frame_time)) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 missed_begin_frame_args_ = args; | 98 missed_begin_frame_args_ = args; |
85 missed_begin_frame_args_.type = cc::BeginFrameArgs::MISSED; | 99 missed_begin_frame_args_.type = cc::BeginFrameArgs::MISSED; |
86 CallOnBeginFrame(args); | 100 CallOnBeginFrame(args); |
87 } | 101 } |
88 | 102 |
89 bool CompositorExternalBeginFrameSource::Send(IPC::Message* message) { | 103 bool CompositorExternalBeginFrameSource::Send(IPC::Message* message) { |
90 return message_sender_->Send(message); | 104 return message_sender_->Send(message); |
91 } | 105 } |
92 | 106 |
93 } // namespace content | 107 } // namespace content |
OLD | NEW |