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

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

Issue 2728183002: RendererCompositorFrameSink should handle local surface id allocation (Closed)
Patch Set: Rebase Created 3 years, 9 months 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer_compositor_frame_sink.h" 5 #include "content/renderer/gpu/renderer_compositor_frame_sink.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 begin_frame_source_ = nullptr; 102 begin_frame_source_ = nullptr;
103 compositor_frame_sink_proxy_->ClearCompositorFrameSink(); 103 compositor_frame_sink_proxy_->ClearCompositorFrameSink();
104 compositor_frame_sink_filter_->RemoveHandlerOnCompositorThread( 104 compositor_frame_sink_filter_->RemoveHandlerOnCompositorThread(
105 routing_id_, compositor_frame_sink_filter_handler_); 105 routing_id_, compositor_frame_sink_filter_handler_);
106 106
107 cc::CompositorFrameSink::DetachFromClient(); 107 cc::CompositorFrameSink::DetachFromClient();
108 } 108 }
109 109
110 void RendererCompositorFrameSink::SubmitCompositorFrame( 110 void RendererCompositorFrameSink::SubmitCompositorFrame(
111 cc::CompositorFrame frame) { 111 cc::CompositorFrame frame) {
112 float device_scale_factor = frame.metadata.device_scale_factor;
113 cc::RenderPass* root_pass = frame.render_pass_list.back().get();
114 gfx::Size frame_size = root_pass->output_rect.size();
115
116 if (!local_surface_id_.is_valid() || frame_size != last_frame_size_ ||
Fady Samuel 2017/03/15 12:05:48 As discussed offline you need all the conditions c
Saman Sami 2017/03/16 18:33:07 Done.
117 device_scale_factor != last_device_scale_factor_)
118 local_surface_id_ = id_allocator_.GenerateId();
119
120 last_frame_size_ = frame_size;
121 last_device_scale_factor_ = device_scale_factor;
122
112 { 123 {
113 std::unique_ptr<FrameSwapMessageQueue::SendMessageScope> 124 std::unique_ptr<FrameSwapMessageQueue::SendMessageScope>
114 send_message_scope = 125 send_message_scope =
115 frame_swap_message_queue_->AcquireSendMessageScope(); 126 frame_swap_message_queue_->AcquireSendMessageScope();
116 std::vector<std::unique_ptr<IPC::Message>> messages; 127 std::vector<std::unique_ptr<IPC::Message>> messages;
117 std::vector<IPC::Message> messages_to_deliver_with_frame; 128 std::vector<IPC::Message> messages_to_deliver_with_frame;
118 frame_swap_message_queue_->DrainMessages(&messages); 129 frame_swap_message_queue_->DrainMessages(&messages);
119 FrameSwapMessageQueue::TransferMessages(&messages, 130 FrameSwapMessageQueue::TransferMessages(&messages,
120 &messages_to_deliver_with_frame); 131 &messages_to_deliver_with_frame);
121 Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, 132 Send(new ViewHostMsg_SwapCompositorFrame(
122 compositor_frame_sink_id_, frame, 133 routing_id_, compositor_frame_sink_id_, local_surface_id_, frame,
123 messages_to_deliver_with_frame)); 134 messages_to_deliver_with_frame));
124 // ~send_message_scope. 135 // ~send_message_scope.
125 } 136 }
126 } 137 }
127 138
128 void RendererCompositorFrameSink::OnMessageReceived( 139 void RendererCompositorFrameSink::OnMessageReceived(
129 const IPC::Message& message) { 140 const IPC::Message& message) {
130 DCHECK(thread_checker_.CalledOnValidThread()); 141 DCHECK(thread_checker_.CalledOnValidThread());
131 IPC_BEGIN_MESSAGE_MAP(RendererCompositorFrameSink, message) 142 IPC_BEGIN_MESSAGE_MAP(RendererCompositorFrameSink, message)
132 IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources, 143 IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources,
133 OnReclaimCompositorResources); 144 OnReclaimCompositorResources);
(...skipping 11 matching lines...) Expand all
145 client_->ReclaimResources(resources); 156 client_->ReclaimResources(resources);
146 if (is_swap_ack) 157 if (is_swap_ack)
147 client_->DidReceiveCompositorFrameAck(); 158 client_->DidReceiveCompositorFrameAck();
148 } 159 }
149 160
150 bool RendererCompositorFrameSink::Send(IPC::Message* message) { 161 bool RendererCompositorFrameSink::Send(IPC::Message* message) {
151 return message_sender_->Send(message); 162 return message_sender_->Send(message);
152 } 163 }
153 164
154 } // namespace content 165 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698