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 "blimp/client/app/compositor/browser_compositor.h" | 5 #include "blimp/client/app/compositor/browser_compositor.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
9 #include "blimp/client/feature/compositor/blimp_context_provider.h" | 9 #include "blimp/client/feature/compositor/blimp_context_provider.h" |
10 #include "blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.h" | 10 #include "blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 display_->Resize(viewport_size_in_px_); | 135 display_->Resize(viewport_size_in_px_); |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 void BrowserCompositor::SetAcceleratedWidget(gfx::AcceleratedWidget widget) { | 139 void BrowserCompositor::SetAcceleratedWidget(gfx::AcceleratedWidget widget) { |
140 // Kill all references to the old widget. | 140 // Kill all references to the old widget. |
141 if (widget_ != gfx::kNullAcceleratedWidget) { | 141 if (widget_ != gfx::kNullAcceleratedWidget) { |
142 // We are always visible if we have a widget. | 142 // We are always visible if we have a widget. |
143 DCHECK(host_->visible()); | 143 DCHECK(host_->visible()); |
144 host_->SetVisible(false); | 144 host_->SetVisible(false); |
145 if (!host_->output_surface_lost()) { | 145 host_->ReleaseOutputSurface(); |
146 host_->ReleaseOutputSurface(); | |
147 } | |
148 display_.reset(); | 146 display_.reset(); |
149 } | 147 } |
150 | 148 |
151 widget_ = gfx::kNullAcceleratedWidget; | 149 widget_ = gfx::kNullAcceleratedWidget; |
152 | 150 |
153 if (widget != gfx::kNullAcceleratedWidget) { | 151 if (widget != gfx::kNullAcceleratedWidget) { |
154 widget_ = widget; | 152 widget_ = widget; |
155 host_->SetVisible(true); | 153 host_->SetVisible(true); |
156 if (output_surface_request_pending_) | 154 if (output_surface_request_pending_) |
157 HandlePendingOutputSurfaceRequest(); | 155 HandlePendingOutputSurfaceRequest(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 std::unique_ptr<cc::OutputSurface> delegated_output_surface = | 214 std::unique_ptr<cc::OutputSurface> delegated_output_surface = |
217 base::MakeUnique<cc::SurfaceDisplayOutputSurface>( | 215 base::MakeUnique<cc::SurfaceDisplayOutputSurface>( |
218 BrowserCompositor::GetSurfaceManager(), surface_id_allocator_.get(), | 216 BrowserCompositor::GetSurfaceManager(), surface_id_allocator_.get(), |
219 display_.get(), context_provider, nullptr); | 217 display_.get(), context_provider, nullptr); |
220 | 218 |
221 host_->SetOutputSurface(std::move(delegated_output_surface)); | 219 host_->SetOutputSurface(std::move(delegated_output_surface)); |
222 } | 220 } |
223 | 221 |
224 } // namespace client | 222 } // namespace client |
225 } // namespace blimp | 223 } // namespace blimp |
OLD | NEW |