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

Side by Side Diff: cc/surfaces/direct_compositor_frame_sink.cc

Issue 2683583005: Move display_ From CompositorFrameSinkSupport To GpuDisplayCompositorFrameSink (Closed)
Patch Set: addressed comments Created 3 years, 10 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 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 "cc/surfaces/direct_compositor_frame_sink.h" 5 #include "cc/surfaces/direct_compositor_frame_sink.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/compositor_frame_sink_client.h" 9 #include "cc/output/compositor_frame_sink_client.h"
10 #include "cc/surfaces/display.h" 10 #include "cc/surfaces/display.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 if (!CompositorFrameSink::BindToClient(client)) 61 if (!CompositorFrameSink::BindToClient(client))
62 return false; 62 return false;
63 63
64 // We want the Display's output surface to hear about lost context, and since 64 // We want the Display's output surface to hear about lost context, and since
65 // this shares a context with it, we should not be listening for lost context 65 // this shares a context with it, we should not be listening for lost context
66 // callbacks on the context here. 66 // callbacks on the context here.
67 if (auto* cp = context_provider()) 67 if (auto* cp = context_provider())
68 cp->SetLostContextCallback(base::Closure()); 68 cp->SetLostContextCallback(base::Closure());
69 69
70 support_ = base::MakeUnique<CompositorFrameSinkSupport>( 70 support_ = base::MakeUnique<CompositorFrameSinkSupport>(
71 this, surface_manager_, frame_sink_id_, display_, false, 71 this, surface_manager_, frame_sink_id_, false,
72 capabilities_.delegated_sync_points_required); 72 capabilities_.delegated_sync_points_required, true /* has_display */);
danakj 2017/02/08 19:23:38 nit: here you could use a temp bool var to give th
Alex Z. 2017/02/08 21:26:47 Done.
73 73
74 begin_frame_source_ = base::MakeUnique<ExternalBeginFrameSource>(this); 74 begin_frame_source_ = base::MakeUnique<ExternalBeginFrameSource>(this);
75 client_->SetBeginFrameSource(begin_frame_source_.get()); 75 client_->SetBeginFrameSource(begin_frame_source_.get());
76
76 // Avoid initializing GL context here, as this should be sharing the 77 // Avoid initializing GL context here, as this should be sharing the
xlai (Olivia) 2017/02/08 20:11:34 Display::Initialize may initialize the GLRenderer
Alex Z. 2017/02/08 21:26:47 It is. Most changes in this file are to restore th
77 // Display's context. 78 // Display's context.
79 display_->Initialize(this, surface_manager_);
xlai (Olivia) 2017/02/08 20:11:34 DCHECK(display_) ?
78 80
79 return true; 81 return true;
80 } 82 }
81 83
82 void DirectCompositorFrameSink::DetachFromClient() { 84 void DirectCompositorFrameSink::DetachFromClient() {
83 client_->SetBeginFrameSource(nullptr); 85 client_->SetBeginFrameSource(nullptr);
84 begin_frame_source_.reset(); 86 begin_frame_source_.reset();
85 support_.reset(); 87 support_.reset();
86 CompositorFrameSink::DetachFromClient(); 88 CompositorFrameSink::DetachFromClient();
87 } 89 }
88 90
89 void DirectCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { 91 void DirectCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) {
90 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); 92 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
91 if (frame_size.IsEmpty() || frame_size != last_swap_frame_size_) { 93 if (frame_size.IsEmpty() || frame_size != last_swap_frame_size_) {
92 delegated_local_surface_id_ = surface_id_allocator_.GenerateId(); 94 delegated_local_surface_id_ = surface_id_allocator_.GenerateId();
93 last_swap_frame_size_ = frame_size; 95 last_swap_frame_size_ = frame_size;
94 } 96 }
97 display_->SetLocalSurfaceId(delegated_local_surface_id_,
xlai (Olivia) 2017/02/08 20:11:34 DCHECK(display_) ?
98 frame.metadata.device_scale_factor);
95 support_->SubmitCompositorFrame(delegated_local_surface_id_, 99 support_->SubmitCompositorFrame(delegated_local_surface_id_,
96 std::move(frame)); 100 std::move(frame));
97 } 101 }
98 102
99 void DirectCompositorFrameSink::ForceReclaimResources() { 103 void DirectCompositorFrameSink::ForceReclaimResources() {
100 support_->ForceReclaimResources(); 104 support_->ForceReclaimResources();
101 } 105 }
102 106
103 void DirectCompositorFrameSink::DisplayOutputSurfaceLost() { 107 void DirectCompositorFrameSink::DisplayOutputSurfaceLost() {
104 is_lost_ = true; 108 is_lost_ = true;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 140
137 void DirectCompositorFrameSink::DidDrawCallback() { 141 void DirectCompositorFrameSink::DidDrawCallback() {
138 client_->DidReceiveCompositorFrameAck(); 142 client_->DidReceiveCompositorFrameAck();
139 } 143 }
140 144
141 void DirectCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frame) { 145 void DirectCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frame) {
142 support_->SetNeedsBeginFrame(needs_begin_frame); 146 support_->SetNeedsBeginFrame(needs_begin_frame);
143 } 147 }
144 148
145 } // namespace cc 149 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698