| OLD | NEW |
| 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 "ui/aura/local/window_port_local.h" | 5 #include "ui/aura/local/window_port_local.h" |
| 6 | 6 |
| 7 #include "cc/surfaces/surface_manager.h" | 7 #include "cc/surfaces/surface_manager.h" |
| 8 #include "ui/aura/client/cursor_client.h" | 8 #include "ui/aura/client/cursor_client.h" |
| 9 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
| 10 #include "ui/aura/local/compositor_frame_sink_local.h" | 10 #include "ui/aura/local/compositor_frame_sink_local.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 &WindowPortLocal::OnSurfaceChanged, weak_factory_.GetWeakPtr())); | 104 &WindowPortLocal::OnSurfaceChanged, weak_factory_.GetWeakPtr())); |
| 105 if (window_->GetRootWindow()) | 105 if (window_->GetRootWindow()) |
| 106 window_->layer()->GetCompositor()->AddFrameSink(frame_sink_id_); | 106 window_->layer()->GetCompositor()->AddFrameSink(frame_sink_id_); |
| 107 return std::move(frame_sink); | 107 return std::move(frame_sink); |
| 108 } | 108 } |
| 109 | 109 |
| 110 cc::SurfaceId WindowPortLocal::GetSurfaceId() const { | 110 cc::SurfaceId WindowPortLocal::GetSurfaceId() const { |
| 111 return cc::SurfaceId(frame_sink_id_, local_surface_id_); | 111 return cc::SurfaceId(frame_sink_id_, local_surface_id_); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void WindowPortLocal::SetNeedsBeginFrames(bool needs, |
| 115 base::RepeatingClosure callback) { |
| 116 NOTREACHED(); |
| 117 } |
| 118 |
| 114 void WindowPortLocal::OnWindowAddedToRootWindow() { | 119 void WindowPortLocal::OnWindowAddedToRootWindow() { |
| 115 if (frame_sink_id_.is_valid()) | 120 if (frame_sink_id_.is_valid()) |
| 116 window_->layer()->GetCompositor()->AddFrameSink(frame_sink_id_); | 121 window_->layer()->GetCompositor()->AddFrameSink(frame_sink_id_); |
| 117 } | 122 } |
| 118 | 123 |
| 119 void WindowPortLocal::OnWillRemoveWindowFromRootWindow() { | 124 void WindowPortLocal::OnWillRemoveWindowFromRootWindow() { |
| 120 if (frame_sink_id_.is_valid()) | 125 if (frame_sink_id_.is_valid()) |
| 121 window_->layer()->GetCompositor()->RemoveFrameSink(frame_sink_id_); | 126 window_->layer()->GetCompositor()->RemoveFrameSink(frame_sink_id_); |
| 122 } | 127 } |
| 123 | 128 |
| 124 void WindowPortLocal::OnSurfaceChanged(const cc::SurfaceId& surface_id, | 129 void WindowPortLocal::OnSurfaceChanged(const cc::SurfaceId& surface_id, |
| 125 const gfx::Size& surface_size) { | 130 const gfx::Size& surface_size) { |
| 126 DCHECK_EQ(surface_id.frame_sink_id(), frame_sink_id_); | 131 DCHECK_EQ(surface_id.frame_sink_id(), frame_sink_id_); |
| 127 local_surface_id_ = surface_id.local_surface_id(); | 132 local_surface_id_ = surface_id.local_surface_id(); |
| 128 // The bounds must be updated before switching to the new surface, because | 133 // The bounds must be updated before switching to the new surface, because |
| 129 // the layer may be mirrored, in which case a surface change causes the | 134 // the layer may be mirrored, in which case a surface change causes the |
| 130 // mirror layer to update its surface using the latest bounds. | 135 // mirror layer to update its surface using the latest bounds. |
| 131 window_->layer()->SetBounds( | 136 window_->layer()->SetBounds( |
| 132 gfx::Rect(window_->layer()->bounds().origin(), surface_size)); | 137 gfx::Rect(window_->layer()->bounds().origin(), surface_size)); |
| 133 window_->layer()->SetShowPrimarySurface( | 138 window_->layer()->SetShowPrimarySurface( |
| 134 cc::SurfaceInfo(surface_id, 1.0f, surface_size), | 139 cc::SurfaceInfo(surface_id, 1.0f, surface_size), |
| 135 aura::Env::GetInstance() | 140 aura::Env::GetInstance() |
| 136 ->context_factory_private() | 141 ->context_factory_private() |
| 137 ->GetSurfaceManager() | 142 ->GetSurfaceManager() |
| 138 ->reference_factory()); | 143 ->reference_factory()); |
| 139 } | 144 } |
| 140 | 145 |
| 141 } // namespace aura | 146 } // namespace aura |
| OLD | NEW |