OLD | NEW |
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 "components/mus/ws/server_window_surface.h" | 5 #include "components/mus/ws/server_window_surface.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
9 #include "cc/quads/shared_quad_state.h" | 9 #include "cc/quads/shared_quad_state.h" |
10 #include "cc/quads/surface_draw_quad.h" | 10 #include "cc/quads/surface_draw_quad.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // surface, otherwise when drawn you get an empty surface. To deal with | 63 // surface, otherwise when drawn you get an empty surface. To deal with |
64 // this we schedule destruction via the delegate. The delegate will call | 64 // this we schedule destruction via the delegate. The delegate will call |
65 // us back when we're not waiting on a frame to be drawn (which may be | 65 // us back when we're not waiting on a frame to be drawn (which may be |
66 // synchronously). | 66 // synchronously). |
67 surfaces_scheduled_for_destruction_.insert(surface_id_); | 67 surfaces_scheduled_for_destruction_.insert(surface_id_); |
68 window()->delegate()->ScheduleSurfaceDestruction(window()); | 68 window()->delegate()->ScheduleSurfaceDestruction(window()); |
69 surface_id_ = manager_->GenerateId(); | 69 surface_id_ = manager_->GenerateId(); |
70 surface_factory_.Create(surface_id_); | 70 surface_factory_.Create(surface_id_); |
71 } | 71 } |
72 } | 72 } |
73 std::unique_ptr<cc::CompositorFrame> frame_copy(new cc::CompositorFrame); | 73 surface_factory_.SubmitCompositorFrame(surface_id_, std::move(frame), |
74 *frame_copy = std::move(frame); | |
75 surface_factory_.SubmitCompositorFrame(surface_id_, std::move(frame_copy), | |
76 base::Bind(&CallCallback, callback)); | 74 base::Bind(&CallCallback, callback)); |
77 last_submitted_frame_size_ = frame_size; | 75 last_submitted_frame_size_ = frame_size; |
78 window()->delegate()->OnScheduleWindowPaint(window()); | 76 window()->delegate()->OnScheduleWindowPaint(window()); |
79 } | 77 } |
80 | 78 |
81 void ServerWindowSurface::DestroySurfacesScheduledForDestruction() { | 79 void ServerWindowSurface::DestroySurfacesScheduledForDestruction() { |
82 std::set<cc::SurfaceId> surfaces; | 80 std::set<cc::SurfaceId> surfaces; |
83 surfaces.swap(surfaces_scheduled_for_destruction_); | 81 surfaces.swap(surfaces_scheduled_for_destruction_); |
84 for (auto& id : surfaces) | 82 for (auto& id : surfaces) |
85 surface_factory_.Destroy(id); | 83 surface_factory_.Destroy(id); |
(...skipping 17 matching lines...) Expand all Loading... |
103 client_->ReturnResources(mojo::Array<cc::ReturnedResource>::From(resources)); | 101 client_->ReturnResources(mojo::Array<cc::ReturnedResource>::From(resources)); |
104 } | 102 } |
105 | 103 |
106 void ServerWindowSurface::SetBeginFrameSource( | 104 void ServerWindowSurface::SetBeginFrameSource( |
107 cc::BeginFrameSource* begin_frame_source) { | 105 cc::BeginFrameSource* begin_frame_source) { |
108 // TODO(tansell): Implement this. | 106 // TODO(tansell): Implement this. |
109 } | 107 } |
110 | 108 |
111 } // namespace ws | 109 } // namespace ws |
112 } // namespace mus | 110 } // namespace mus |
OLD | NEW |