| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "cc/output/output_surface.h" | 5 #include "cc/output/output_surface.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 client_thread_checker_.DetachFromThread(); | 130 client_thread_checker_.DetachFromThread(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 OutputSurface::OutputSurface( | 133 OutputSurface::OutputSurface( |
| 134 scoped_refptr<VulkanContextProvider> vulkan_context_provider) | 134 scoped_refptr<VulkanContextProvider> vulkan_context_provider) |
| 135 : vulkan_context_provider_(vulkan_context_provider), | 135 : vulkan_context_provider_(vulkan_context_provider), |
| 136 weak_ptr_factory_(this) { | 136 weak_ptr_factory_(this) { |
| 137 client_thread_checker_.DetachFromThread(); | 137 client_thread_checker_.DetachFromThread(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 // Forwarded to OutputSurfaceClient | |
| 141 void OutputSurface::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { | |
| 142 TRACE_EVENT0("cc", "OutputSurface::SetNeedsRedrawRect"); | |
| 143 client_->SetNeedsRedrawRect(damage_rect); | |
| 144 } | |
| 145 | |
| 146 void OutputSurface::ReclaimResources(const ReturnedResourceArray& resources) { | |
| 147 client_->ReclaimResources(resources); | |
| 148 } | |
| 149 | |
| 150 void OutputSurface::DidLoseOutputSurface() { | |
| 151 TRACE_EVENT0("cc", "OutputSurface::DidLoseOutputSurface"); | |
| 152 client_->DidLoseOutputSurface(); | |
| 153 } | |
| 154 | |
| 155 void OutputSurface::SetExternalStencilTest(bool enabled) { | |
| 156 external_stencil_test_enabled_ = enabled; | |
| 157 } | |
| 158 | |
| 159 OutputSurface::~OutputSurface() { | 140 OutputSurface::~OutputSurface() { |
| 160 if (client_) | 141 if (client_) |
| 161 DetachFromClientInternal(); | 142 DetachFromClientInternal(); |
| 162 } | 143 } |
| 163 | 144 |
| 164 bool OutputSurface::HasExternalStencilTest() const { | 145 bool OutputSurface::HasExternalStencilTest() const { |
| 165 return external_stencil_test_enabled_; | 146 return false; |
| 166 } | 147 } |
| 167 | 148 |
| 168 void OutputSurface::ApplyExternalStencil() {} | 149 void OutputSurface::ApplyExternalStencil() {} |
| 169 | 150 |
| 170 bool OutputSurface::BindToClient(OutputSurfaceClient* client) { | 151 bool OutputSurface::BindToClient(OutputSurfaceClient* client) { |
| 171 DCHECK(client_thread_checker_.CalledOnValidThread()); | 152 DCHECK(client_thread_checker_.CalledOnValidThread()); |
| 172 DCHECK(client); | 153 DCHECK(client); |
| 173 DCHECK(!client_); | 154 DCHECK(!client_); |
| 174 client_ = client; | 155 client_ = client; |
| 175 bool success = true; | 156 bool success = true; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 287 |
| 307 if (context_provider_.get()) { | 288 if (context_provider_.get()) { |
| 308 context_provider_->SetLostContextCallback( | 289 context_provider_->SetLostContextCallback( |
| 309 ContextProvider::LostContextCallback()); | 290 ContextProvider::LostContextCallback()); |
| 310 } | 291 } |
| 311 context_provider_ = nullptr; | 292 context_provider_ = nullptr; |
| 312 client_ = nullptr; | 293 client_ = nullptr; |
| 313 weak_ptr_factory_.InvalidateWeakPtrs(); | 294 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 314 } | 295 } |
| 315 | 296 |
| 297 void OutputSurface::DidLoseOutputSurface() { |
| 298 TRACE_EVENT0("cc", "OutputSurface::DidLoseOutputSurface"); |
| 299 client_->DidLoseOutputSurface(); |
| 300 } |
| 301 |
| 316 } // namespace cc | 302 } // namespace cc |
| OLD | NEW |