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

Side by Side Diff: services/ui/ws/server_window_compositor_frame_sink.cc

Issue 2453013002: Mus: Remove dependency on ServerWindowCompositorFrameSink from FrameGenerator (Closed)
Patch Set: Rebased Created 4 years, 1 month 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 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/ws/server_window_compositor_frame_sink.h" 5 #include "services/ui/ws/server_window_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 "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "cc/quads/shared_quad_state.h" 10 #include "cc/quads/shared_quad_state.h"
(...skipping 15 matching lines...) Expand all
26 manager_(manager), 26 manager_(manager),
27 surface_factory_(frame_sink_id_, 27 surface_factory_(frame_sink_id_,
28 manager_->GetCompositorFrameSinkManager(), 28 manager_->GetCompositorFrameSinkManager(),
29 this), 29 this),
30 client_(std::move(client)), 30 client_(std::move(client)),
31 binding_(this, std::move(request)) { 31 binding_(this, std::move(request)) {
32 cc::SurfaceManager* surface_manager = 32 cc::SurfaceManager* surface_manager =
33 manager_->GetCompositorFrameSinkManager(); 33 manager_->GetCompositorFrameSinkManager();
34 surface_manager->RegisterFrameSinkId(frame_sink_id_); 34 surface_manager->RegisterFrameSinkId(frame_sink_id_);
35 surface_manager->RegisterSurfaceFactoryClient(frame_sink_id_, this); 35 surface_manager->RegisterSurfaceFactoryClient(frame_sink_id_, this);
36 surface_sequence_generator_.set_frame_sink_id(frame_sink_id_);
37 } 36 }
38 37
39 ServerWindowCompositorFrameSink::~ServerWindowCompositorFrameSink() { 38 ServerWindowCompositorFrameSink::~ServerWindowCompositorFrameSink() {
40 // SurfaceFactory's destructor will attempt to return resources which will 39 // SurfaceFactory's destructor will attempt to return resources which will
41 // call back into here and access |client_| so we should destroy 40 // call back into here and access |client_| so we should destroy
42 // |surface_factory_|'s resources early on. 41 // |surface_factory_|'s resources early on.
43 surface_factory_.DestroyAll(); 42 surface_factory_.DestroyAll();
44 cc::SurfaceManager* surface_manager = 43 cc::SurfaceManager* surface_manager =
45 manager_->GetCompositorFrameSinkManager(); 44 manager_->GetCompositorFrameSinkManager();
46 surface_manager->UnregisterSurfaceFactoryClient(frame_sink_id_); 45 surface_manager->UnregisterSurfaceFactoryClient(frame_sink_id_);
(...skipping 10 matching lines...) Expand all
57 gfx::Size frame_size = 56 gfx::Size frame_size =
58 frame.delegated_frame_data->render_pass_list[0]->output_rect.size(); 57 frame.delegated_frame_data->render_pass_list[0]->output_rect.size();
59 // If the size of the CompostiorFrame has changed then destroy the existing 58 // If the size of the CompostiorFrame has changed then destroy the existing
60 // Surface and create a new one of the appropriate size. 59 // Surface and create a new one of the appropriate size.
61 if (local_frame_id_.is_null() || frame_size != last_submitted_frame_size_) { 60 if (local_frame_id_.is_null() || frame_size != last_submitted_frame_size_) {
62 if (!local_frame_id_.is_null()) 61 if (!local_frame_id_.is_null())
63 surface_factory_.Destroy(local_frame_id_); 62 surface_factory_.Destroy(local_frame_id_);
64 local_frame_id_ = surface_id_allocator_.GenerateId(); 63 local_frame_id_ = surface_id_allocator_.GenerateId();
65 surface_factory_.Create(local_frame_id_); 64 surface_factory_.Create(local_frame_id_);
66 } 65 }
67 may_contain_video_ = frame.metadata.may_contain_video;
68 surface_factory_.SubmitCompositorFrame( 66 surface_factory_.SubmitCompositorFrame(
69 local_frame_id_, std::move(frame), 67 local_frame_id_, std::move(frame),
70 base::Bind(&ServerWindowCompositorFrameSink::DidReceiveCompositorFrameAck, 68 base::Bind(&ServerWindowCompositorFrameSink::DidReceiveCompositorFrameAck,
71 base::Unretained(this))); 69 base::Unretained(this)));
72 last_submitted_frame_size_ = frame_size; 70 last_submitted_frame_size_ = frame_size;
73 window()->delegate()->OnScheduleWindowPaint(window()); 71 ServerWindow* window = manager_->window_;
74 } 72 window->delegate()->OnScheduleWindowPaint(window);
75
76 cc::SurfaceId ServerWindowCompositorFrameSink::GetSurfaceId() const {
77 if (local_frame_id_.is_null())
78 return cc::SurfaceId();
79 return cc::SurfaceId(frame_sink_id_, local_frame_id_);
80 }
81
82 cc::SurfaceSequence ServerWindowCompositorFrameSink::CreateSurfaceSequence() {
83 return surface_sequence_generator_.CreateSurfaceSequence();
84 }
85
86 ServerWindow* ServerWindowCompositorFrameSink::window() {
87 return manager_->window();
88 } 73 }
89 74
90 void ServerWindowCompositorFrameSink::DidReceiveCompositorFrameAck() { 75 void ServerWindowCompositorFrameSink::DidReceiveCompositorFrameAck() {
91 if (!client_ || !base::MessageLoop::current()) 76 if (!client_ || !base::MessageLoop::current())
92 return; 77 return;
93 client_->DidReceiveCompositorFrameAck(); 78 client_->DidReceiveCompositorFrameAck();
94 } 79 }
95 80
96 void ServerWindowCompositorFrameSink::ReturnResources( 81 void ServerWindowCompositorFrameSink::ReturnResources(
97 const cc::ReturnedResourceArray& resources) { 82 const cc::ReturnedResourceArray& resources) {
98 if (!client_ || !base::MessageLoop::current()) 83 if (!client_ || !base::MessageLoop::current())
99 return; 84 return;
100 client_->ReclaimResources(resources); 85 client_->ReclaimResources(resources);
101 } 86 }
102 87
103 void ServerWindowCompositorFrameSink::SetBeginFrameSource( 88 void ServerWindowCompositorFrameSink::SetBeginFrameSource(
104 cc::BeginFrameSource* begin_frame_source) { 89 cc::BeginFrameSource* begin_frame_source) {
105 // TODO(tansell): Implement this. 90 // TODO(tansell): Implement this.
106 } 91 }
107 92
108 } // namespace ws 93 } // namespace ws
109 } // namespace ui 94 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/server_window_compositor_frame_sink.h ('k') | services/ui/ws/server_window_compositor_frame_sink_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698