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

Side by Side Diff: components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.cc

Issue 2937233002: Use HitTestAggregator in GpuRootCompositorFrameSink (Closed)
Patch Set: rebase Created 3 years, 5 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
« no previous file with comments | « components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.h" 5 #include "components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h"
9 #include "components/viz/service/display/display.h" 10 #include "components/viz/service/display/display.h"
10 #include "components/viz/service/frame_sinks/compositor_frame_sink_support.h" 11 #include "components/viz/service/frame_sinks/compositor_frame_sink_support.h"
11 #include "components/viz/service/frame_sinks/frame_sink_manager.h" 12 #include "components/viz/service/frame_sinks/frame_sink_manager.h"
12 13
13 namespace viz { 14 namespace viz {
14 15
15 GpuRootCompositorFrameSink::GpuRootCompositorFrameSink( 16 GpuRootCompositorFrameSink::GpuRootCompositorFrameSink(
16 GpuCompositorFrameSinkDelegate* delegate, 17 GpuCompositorFrameSinkDelegate* delegate,
17 FrameSinkManager* frame_sink_manager, 18 FrameSinkManager* frame_sink_manager,
18 const FrameSinkId& frame_sink_id, 19 const FrameSinkId& frame_sink_id,
(...skipping 23 matching lines...) Expand all
42 DCHECK(display_begin_frame_source_); 43 DCHECK(display_begin_frame_source_);
43 compositor_frame_sink_binding_.set_connection_error_handler( 44 compositor_frame_sink_binding_.set_connection_error_handler(
44 base::Bind(&GpuRootCompositorFrameSink::OnClientConnectionLost, 45 base::Bind(&GpuRootCompositorFrameSink::OnClientConnectionLost,
45 base::Unretained(this))); 46 base::Unretained(this)));
46 compositor_frame_sink_private_binding_.set_connection_error_handler( 47 compositor_frame_sink_private_binding_.set_connection_error_handler(
47 base::Bind(&GpuRootCompositorFrameSink::OnPrivateConnectionLost, 48 base::Bind(&GpuRootCompositorFrameSink::OnPrivateConnectionLost,
48 base::Unretained(this))); 49 base::Unretained(this)));
49 frame_sink_manager->RegisterBeginFrameSource( 50 frame_sink_manager->RegisterBeginFrameSource(
50 display_begin_frame_source_.get(), frame_sink_id); 51 display_begin_frame_source_.get(), frame_sink_id);
51 display_->Initialize(this, frame_sink_manager->surface_manager()); 52 display_->Initialize(this, frame_sink_manager->surface_manager());
53
54 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
55 switches::kUseVizHitTest))
56 hit_test_aggregator_ = base::MakeUnique<HitTestAggregator>();
Fady Samuel 2017/07/17 17:08:24 Do we need a switch at all? Any reason not to alwa
gklassen 2017/07/17 21:09:52 It was included to keep runtime cost minimal when
52 } 57 }
53 58
54 GpuRootCompositorFrameSink::~GpuRootCompositorFrameSink() { 59 GpuRootCompositorFrameSink::~GpuRootCompositorFrameSink() {
55 support_->frame_sink_manager()->UnregisterBeginFrameSource( 60 support_->frame_sink_manager()->UnregisterBeginFrameSource(
56 display_begin_frame_source_.get()); 61 display_begin_frame_source_.get());
57 } 62 }
58 63
59 void GpuRootCompositorFrameSink::SetDisplayVisible(bool visible) { 64 void GpuRootCompositorFrameSink::SetDisplayVisible(bool visible) {
60 DCHECK(display_); 65 DCHECK(display_);
61 display_->SetVisible(visible); 66 display_->SetVisible(visible);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 support_->RequestCopyOfSurface(std::move(request)); 116 support_->RequestCopyOfSurface(std::move(request));
112 } 117 }
113 118
114 void GpuRootCompositorFrameSink::DisplayOutputSurfaceLost() { 119 void GpuRootCompositorFrameSink::DisplayOutputSurfaceLost() {
115 // TODO(staraz): Implement this. Client should hear about context/output 120 // TODO(staraz): Implement this. Client should hear about context/output
116 // surface lost. 121 // surface lost.
117 } 122 }
118 123
119 void GpuRootCompositorFrameSink::DisplayWillDrawAndSwap( 124 void GpuRootCompositorFrameSink::DisplayWillDrawAndSwap(
120 bool will_draw_and_swap, 125 bool will_draw_and_swap,
121 const cc::RenderPassList& render_pass) {} 126 const cc::RenderPassList& render_pass) {
127 if (hit_test_aggregator_)
128 hit_test_aggregator_->PostTaskAggregate(display_->CurrentSurfaceId());
129 }
122 130
123 void GpuRootCompositorFrameSink::DisplayDidDrawAndSwap() {} 131 void GpuRootCompositorFrameSink::DisplayDidDrawAndSwap() {}
124 132
125 void GpuRootCompositorFrameSink::DidReceiveCompositorFrameAck( 133 void GpuRootCompositorFrameSink::DidReceiveCompositorFrameAck(
126 const std::vector<cc::ReturnedResource>& resources) { 134 const std::vector<cc::ReturnedResource>& resources) {
127 if (client_) 135 if (client_)
128 client_->DidReceiveCompositorFrameAck(resources); 136 client_->DidReceiveCompositorFrameAck(resources);
129 } 137 }
130 138
131 void GpuRootCompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) { 139 void GpuRootCompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) {
140 if (hit_test_aggregator_)
141 hit_test_aggregator_->Swap();
132 if (client_) 142 if (client_)
133 client_->OnBeginFrame(args); 143 client_->OnBeginFrame(args);
134 } 144 }
135 145
136 void GpuRootCompositorFrameSink::ReclaimResources( 146 void GpuRootCompositorFrameSink::ReclaimResources(
137 const std::vector<cc::ReturnedResource>& resources) { 147 const std::vector<cc::ReturnedResource>& resources) {
138 if (client_) 148 if (client_)
139 client_->ReclaimResources(resources); 149 client_->ReclaimResources(resources);
140 } 150 }
141 151
142 void GpuRootCompositorFrameSink::WillDrawSurface( 152 void GpuRootCompositorFrameSink::WillDrawSurface(
143 const LocalSurfaceId& local_surface_id, 153 const LocalSurfaceId& local_surface_id,
144 const gfx::Rect& damage_rect) {} 154 const gfx::Rect& damage_rect) {}
145 155
146 void GpuRootCompositorFrameSink::OnClientConnectionLost() { 156 void GpuRootCompositorFrameSink::OnClientConnectionLost() {
147 delegate_->OnClientConnectionLost(support_->frame_sink_id()); 157 delegate_->OnClientConnectionLost(support_->frame_sink_id());
148 } 158 }
149 159
150 void GpuRootCompositorFrameSink::OnPrivateConnectionLost() { 160 void GpuRootCompositorFrameSink::OnPrivateConnectionLost() {
151 delegate_->OnPrivateConnectionLost(support_->frame_sink_id()); 161 delegate_->OnPrivateConnectionLost(support_->frame_sink_id());
152 } 162 }
153 163
154 } // namespace viz 164 } // namespace viz
OLDNEW
« no previous file with comments | « components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698