| 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 "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/quads/shared_quad_state.h" | 8 #include "cc/quads/shared_quad_state.h" |
| 9 #include "cc/quads/surface_draw_quad.h" | 9 #include "cc/quads/surface_draw_quad.h" |
| 10 #include "components/mus/surfaces/surfaces_state.h" | 10 #include "components/mus/surfaces/surfaces_state.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 const mojom::CompositorFramePtr& input) { | 92 const mojom::CompositorFramePtr& input) { |
| 93 referenced_window_ids_.clear(); | 93 referenced_window_ids_.clear(); |
| 94 return ConvertToCompositorFrame(input, this); | 94 return ConvertToCompositorFrame(input, this); |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool ServerWindowSurface::ConvertSurfaceDrawQuad( | 97 bool ServerWindowSurface::ConvertSurfaceDrawQuad( |
| 98 const mojom::QuadPtr& input, | 98 const mojom::QuadPtr& input, |
| 99 const mojom::CompositorFrameMetadataPtr& metadata, | 99 const mojom::CompositorFrameMetadataPtr& metadata, |
| 100 cc::SharedQuadState* sqs, | 100 cc::SharedQuadState* sqs, |
| 101 cc::RenderPass* render_pass) { | 101 cc::RenderPass* render_pass) { |
| 102 Id id = static_cast<Id>( | 102 // Surface ids originate from the client, meaning they are ClientWindowIds |
| 103 // and can only be resolved by the client that submitted the frame. |
| 104 const ClientWindowId other_client_window_id( |
| 103 input->surface_quad_state->surface.To<cc::SurfaceId>().id); | 105 input->surface_quad_state->surface.To<cc::SurfaceId>().id); |
| 104 // TODO(sky): this is now wrong, needs mapping from client to window. | 106 ServerWindow* other_window = window()->delegate()->FindWindowForSurface( |
| 105 WindowId other_window_id = WindowIdFromTransportId(id); | 107 window(), mojom::SurfaceType::DEFAULT, other_client_window_id); |
| 106 ServerWindow* other_window = window()->GetChildWindow(other_window_id); | |
| 107 if (!other_window) { | 108 if (!other_window) { |
| 108 DVLOG(2) << "The window ID '" << id << "' does not exist."; | 109 DVLOG(2) << "The window ID '" << other_client_window_id.id |
| 110 << "' does not exist."; |
| 109 // TODO(fsamuel): We return true here so that the CompositorFrame isn't | 111 // TODO(fsamuel): We return true here so that the CompositorFrame isn't |
| 110 // entirely rejected. We just drop this SurfaceDrawQuad. This failure | 112 // entirely rejected. We just drop this SurfaceDrawQuad. This failure |
| 111 // can happen if the client has an out of date view of the window tree. | 113 // can happen if the client has an out of date view of the window tree. |
| 112 // It would be nice if we can avoid reaching this state in the future. | 114 // It would be nice if we can avoid reaching this state in the future. |
| 113 return true; | 115 return true; |
| 114 } | 116 } |
| 115 | 117 |
| 116 referenced_window_ids_.insert(other_window_id); | 118 referenced_window_ids_.insert(other_window->id()); |
| 117 | 119 |
| 118 ServerWindowSurface* default_surface = | 120 ServerWindowSurface* default_surface = |
| 119 other_window->GetOrCreateSurfaceManager()->GetDefaultSurface(); | 121 other_window->GetOrCreateSurfaceManager()->GetDefaultSurface(); |
| 120 ServerWindowSurface* underlay_surface = | 122 ServerWindowSurface* underlay_surface = |
| 121 other_window->GetOrCreateSurfaceManager()->GetUnderlaySurface(); | 123 other_window->GetOrCreateSurfaceManager()->GetUnderlaySurface(); |
| 122 | 124 |
| 123 if (!default_surface && !underlay_surface) | 125 if (!default_surface && !underlay_surface) |
| 124 return true; | 126 return true; |
| 125 | 127 |
| 126 cc::SurfaceDrawQuad* surface_quad = | 128 cc::SurfaceDrawQuad* surface_quad = |
| (...skipping 24 matching lines...) Expand all Loading... |
| 151 } | 153 } |
| 152 | 154 |
| 153 void ServerWindowSurface::SetBeginFrameSource( | 155 void ServerWindowSurface::SetBeginFrameSource( |
| 154 cc::SurfaceId surface_id, | 156 cc::SurfaceId surface_id, |
| 155 cc::BeginFrameSource* begin_frame_source) { | 157 cc::BeginFrameSource* begin_frame_source) { |
| 156 // TODO(tansell): Implement this. | 158 // TODO(tansell): Implement this. |
| 157 } | 159 } |
| 158 | 160 |
| 159 } // namespace ws | 161 } // namespace ws |
| 160 } // namespace mus | 162 } // namespace mus |
| OLD | NEW |