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

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

Issue 2435193003: Mus: surfaces::CompositorFrameSink => DisplayCompositorFrameSink (Closed)
Patch Set: Created 4 years, 2 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 | « services/ui/surfaces/display_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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/compositor_frame_sink.h" 5 #include "services/ui/surfaces/display_compositor_frame_sink.h"
6 6
7 #include "cc/output/copy_output_request.h" 7 #include "cc/output/copy_output_request.h"
8 #include "cc/output/output_surface.h" 8 #include "cc/output/output_surface.h"
9 #include "cc/output/renderer_settings.h" 9 #include "cc/output/renderer_settings.h"
10 #include "cc/output/texture_mailbox_deleter.h" 10 #include "cc/output/texture_mailbox_deleter.h"
11 #include "cc/scheduler/begin_frame_source.h" 11 #include "cc/scheduler/begin_frame_source.h"
12 #include "cc/scheduler/delay_based_time_source.h" 12 #include "cc/scheduler/delay_based_time_source.h"
13 #include "cc/surfaces/display.h" 13 #include "cc/surfaces/display.h"
14 #include "cc/surfaces/display_scheduler.h" 14 #include "cc/surfaces/display_scheduler.h"
15 #include "cc/surfaces/frame_sink_id.h" 15 #include "cc/surfaces/frame_sink_id.h"
16 #include "gpu/ipc/client/gpu_channel_host.h" 16 #include "gpu/ipc/client/gpu_channel_host.h"
17 #include "services/ui/surfaces/direct_output_surface.h" 17 #include "services/ui/surfaces/direct_output_surface.h"
18 #include "services/ui/surfaces/surfaces_context_provider.h" 18 #include "services/ui/surfaces/surfaces_context_provider.h"
19 19
20 #if defined(USE_OZONE) 20 #if defined(USE_OZONE)
21 #include "gpu/command_buffer/client/gles2_interface.h" 21 #include "gpu/command_buffer/client/gles2_interface.h"
22 #include "services/ui/surfaces/direct_output_surface_ozone.h" 22 #include "services/ui/surfaces/direct_output_surface_ozone.h"
23 #endif 23 #endif
24 24
25 namespace ui { 25 namespace ui {
26 namespace surfaces {
27 26
28 CompositorFrameSink::CompositorFrameSink( 27 DisplayCompositorFrameSink::DisplayCompositorFrameSink(
29 const cc::FrameSinkId& frame_sink_id, 28 const cc::FrameSinkId& frame_sink_id,
30 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 29 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
31 gfx::AcceleratedWidget widget, 30 gfx::AcceleratedWidget widget,
32 scoped_refptr<gpu::GpuChannelHost> gpu_channel, 31 scoped_refptr<gpu::GpuChannelHost> gpu_channel,
33 const scoped_refptr<DisplayCompositor>& display_compositor) 32 const scoped_refptr<DisplayCompositor>& display_compositor)
34 : frame_sink_id_(frame_sink_id), 33 : frame_sink_id_(frame_sink_id),
35 task_runner_(task_runner), 34 task_runner_(task_runner),
36 display_compositor_(display_compositor), 35 display_compositor_(display_compositor),
37 factory_(frame_sink_id_, display_compositor->manager(), this) { 36 factory_(frame_sink_id_, display_compositor->manager(), this) {
38 display_compositor_->manager()->RegisterFrameSinkId(frame_sink_id_); 37 display_compositor_->manager()->RegisterFrameSinkId(frame_sink_id_);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 73
75 display_.reset(new cc::Display( 74 display_.reset(new cc::Display(
76 nullptr /* bitmap_manager */, gpu_memory_buffer_manager, 75 nullptr /* bitmap_manager */, gpu_memory_buffer_manager,
77 cc::RendererSettings(), std::move(synthetic_begin_frame_source), 76 cc::RendererSettings(), std::move(synthetic_begin_frame_source),
78 std::move(display_output_surface), std::move(scheduler), 77 std::move(display_output_surface), std::move(scheduler),
79 base::MakeUnique<cc::TextureMailboxDeleter>(task_runner_.get()))); 78 base::MakeUnique<cc::TextureMailboxDeleter>(task_runner_.get())));
80 display_->Initialize(this, display_compositor_->manager(), frame_sink_id_); 79 display_->Initialize(this, display_compositor_->manager(), frame_sink_id_);
81 display_->SetVisible(true); 80 display_->SetVisible(true);
82 } 81 }
83 82
84 CompositorFrameSink::~CompositorFrameSink() { 83 DisplayCompositorFrameSink::~DisplayCompositorFrameSink() {
85 display_compositor_->manager()->UnregisterSurfaceFactoryClient( 84 display_compositor_->manager()->UnregisterSurfaceFactoryClient(
86 frame_sink_id_); 85 frame_sink_id_);
87 display_compositor_->manager()->InvalidateFrameSinkId(frame_sink_id_); 86 display_compositor_->manager()->InvalidateFrameSinkId(frame_sink_id_);
88 } 87 }
89 88
90 void CompositorFrameSink::SubmitCompositorFrame( 89 void DisplayCompositorFrameSink::SubmitCompositorFrame(
91 cc::CompositorFrame frame, 90 cc::CompositorFrame frame,
92 const base::Callback<void()>& callback) { 91 const base::Callback<void()>& callback) {
93 gfx::Size frame_size = 92 gfx::Size frame_size =
94 frame.delegated_frame_data->render_pass_list.back()->output_rect.size(); 93 frame.delegated_frame_data->render_pass_list.back()->output_rect.size();
95 if (frame_size.IsEmpty() || frame_size != display_size_) { 94 if (frame_size.IsEmpty() || frame_size != display_size_) {
96 if (!local_frame_id_.is_null()) 95 if (!local_frame_id_.is_null())
97 factory_.Destroy(local_frame_id_); 96 factory_.Destroy(local_frame_id_);
98 local_frame_id_ = allocator_.GenerateId(); 97 local_frame_id_ = allocator_.GenerateId();
99 factory_.Create(local_frame_id_); 98 factory_.Create(local_frame_id_);
100 display_size_ = frame_size; 99 display_size_ = frame_size;
101 display_->Resize(display_size_); 100 display_->Resize(display_size_);
102 } 101 }
103 display_->SetSurfaceId(cc::SurfaceId(frame_sink_id_, local_frame_id_), 102 display_->SetSurfaceId(cc::SurfaceId(frame_sink_id_, local_frame_id_),
104 frame.metadata.device_scale_factor); 103 frame.metadata.device_scale_factor);
105 factory_.SubmitCompositorFrame(local_frame_id_, std::move(frame), callback); 104 factory_.SubmitCompositorFrame(local_frame_id_, std::move(frame), callback);
106 } 105 }
107 106
108 void CompositorFrameSink::ReturnResources( 107 void DisplayCompositorFrameSink::ReturnResources(
109 const cc::ReturnedResourceArray& resources) { 108 const cc::ReturnedResourceArray& resources) {
110 // TODO(fsamuel): Implement this. 109 // TODO(fsamuel): Implement this.
111 } 110 }
112 111
113 void CompositorFrameSink::SetBeginFrameSource( 112 void DisplayCompositorFrameSink::SetBeginFrameSource(
114 cc::BeginFrameSource* begin_frame_source) { 113 cc::BeginFrameSource* begin_frame_source) {
115 // TODO(fsamuel): Implement this. 114 // TODO(fsamuel): Implement this.
116 } 115 }
117 116
118 void CompositorFrameSink::DisplayOutputSurfaceLost() { 117 void DisplayCompositorFrameSink::DisplayOutputSurfaceLost() {
119 // TODO(fsamuel): This looks like it would crash if a frame was in flight and 118 // TODO(fsamuel): This looks like it would crash if a frame was in flight and
120 // will be submitted. 119 // will be submitted.
121 display_.reset(); 120 display_.reset();
122 } 121 }
123 122
124 void CompositorFrameSink::DisplayWillDrawAndSwap( 123 void DisplayCompositorFrameSink::DisplayWillDrawAndSwap(
125 bool will_draw_and_swap, 124 bool will_draw_and_swap,
126 const cc::RenderPassList& render_passes) { 125 const cc::RenderPassList& render_passes) {
127 // This notification is not relevant to our client outside of tests. 126 // This notification is not relevant to our client outside of tests.
128 } 127 }
129 128
130 void CompositorFrameSink::DisplayDidDrawAndSwap() { 129 void DisplayCompositorFrameSink::DisplayDidDrawAndSwap() {
131 // This notification is not relevant to our client outside of tests. We 130 // This notification is not relevant to our client outside of tests. We
132 // unblock the client from the DrawCallback when the surface is going to 131 // unblock the client from the DrawCallback when the surface is going to
133 // be drawn. 132 // be drawn.
134 } 133 }
135 134
136 } // namespace surfaces
137 } // namespace ui 135 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/surfaces/display_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