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

Side by Side Diff: services/ui/surfaces/gpu_compositor_frame_sink.cc

Issue 2527443002: Display Compositor: Allocate LocalFrameId in client. (Closed)
Patch Set: Rebased + Restored BUILD files 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
« no previous file with comments | « services/ui/surfaces/gpu_compositor_frame_sink.h ('k') | services/ui/ws/frame_generator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "services/ui/surfaces/gpu_compositor_frame_sink.h" 5 #include "services/ui/surfaces/gpu_compositor_frame_sink.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 display_compositor_->manager()->UnregisterSurfaceFactoryClient( 66 display_compositor_->manager()->UnregisterSurfaceFactoryClient(
67 frame_sink_id_); 67 frame_sink_id_);
68 display_compositor_->manager()->InvalidateFrameSinkId(frame_sink_id_); 68 display_compositor_->manager()->InvalidateFrameSinkId(frame_sink_id_);
69 } 69 }
70 70
71 void GpuCompositorFrameSink::SetNeedsBeginFrame(bool needs_begin_frame) { 71 void GpuCompositorFrameSink::SetNeedsBeginFrame(bool needs_begin_frame) {
72 needs_begin_frame_ = needs_begin_frame; 72 needs_begin_frame_ = needs_begin_frame;
73 UpdateNeedsBeginFramesInternal(); 73 UpdateNeedsBeginFramesInternal();
74 } 74 }
75 75
76 void GpuCompositorFrameSink::SubmitCompositorFrame(cc::CompositorFrame frame) { 76 void GpuCompositorFrameSink::SubmitCompositorFrame(
77 gfx::Size frame_size = frame.render_pass_list[0]->output_rect.size(); 77 const cc::LocalFrameId& local_frame_id,
78 cc::CompositorFrame frame) {
78 // If the size of the CompostiorFrame has changed then destroy the existing 79 // If the size of the CompostiorFrame has changed then destroy the existing
79 // Surface and create a new one of the appropriate size. 80 // Surface and create a new one of the appropriate size.
80 if (!local_frame_id_.is_valid() || frame_size != last_submitted_frame_size_) { 81 if (local_frame_id_ != local_frame_id) {
81 if (local_frame_id_.is_valid()) 82 if (local_frame_id_.is_valid())
82 surface_factory_.Destroy(local_frame_id_); 83 surface_factory_.Destroy(local_frame_id_);
83 local_frame_id_ = surface_id_allocator_.GenerateId(); 84 local_frame_id_ = local_frame_id;
84 surface_factory_.Create(local_frame_id_); 85 surface_factory_.Create(local_frame_id_);
85 if (display_) 86 if (display_ && !frame.render_pass_list.empty()) {
87 gfx::Size frame_size = frame.render_pass_list[0]->output_rect.size();
86 display_->Resize(frame_size); 88 display_->Resize(frame_size);
89 }
87 } 90 }
88 ++ack_pending_count_; 91 ++ack_pending_count_;
89 surface_factory_.SubmitCompositorFrame( 92 surface_factory_.SubmitCompositorFrame(
90 local_frame_id_, std::move(frame), 93 local_frame_id_, std::move(frame),
91 base::Bind(&GpuCompositorFrameSink::DidReceiveCompositorFrameAck, 94 base::Bind(&GpuCompositorFrameSink::DidReceiveCompositorFrameAck,
92 base::Unretained(this))); 95 base::Unretained(this)));
93 if (display_) { 96 if (display_) {
94 display_->SetLocalFrameId(local_frame_id_, 97 display_->SetLocalFrameId(local_frame_id_,
95 frame.metadata.device_scale_factor); 98 frame.metadata.device_scale_factor);
96 } 99 }
97 last_submitted_frame_size_ = frame_size;
98 } 100 }
99 101
100 void GpuCompositorFrameSink::DidReceiveCompositorFrameAck() { 102 void GpuCompositorFrameSink::DidReceiveCompositorFrameAck() {
101 if (!client_) 103 if (!client_)
102 return; 104 return;
103 client_->DidReceiveCompositorFrameAck(); 105 client_->DidReceiveCompositorFrameAck();
104 DCHECK_GT(ack_pending_count_, 0); 106 DCHECK_GT(ack_pending_count_, 0);
105 if (!surface_returned_resources_.empty()) { 107 if (!surface_returned_resources_.empty()) {
106 client_->ReclaimResources(surface_returned_resources_); 108 client_->ReclaimResources(surface_returned_resources_);
107 surface_returned_resources_.clear(); 109 surface_returned_resources_.clear();
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 238 }
237 239
238 void GpuCompositorFrameSink::OnPrivateConnectionLost() { 240 void GpuCompositorFrameSink::OnPrivateConnectionLost() {
239 private_connection_lost_ = true; 241 private_connection_lost_ = true;
240 // Request destruction of |this| only if both connections are lost. 242 // Request destruction of |this| only if both connections are lost.
241 display_compositor_->OnCompositorFrameSinkPrivateConnectionLost( 243 display_compositor_->OnCompositorFrameSinkPrivateConnectionLost(
242 frame_sink_id_, client_connection_lost_); 244 frame_sink_id_, client_connection_lost_);
243 } 245 }
244 246
245 } // namespace ui 247 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/surfaces/gpu_compositor_frame_sink.h ('k') | services/ui/ws/frame_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698