| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 uint64_t share_group_tracing_guid_; | 114 uint64_t share_group_tracing_guid_; |
| 115 | 115 |
| 116 DISALLOW_COPY_AND_ASSIGN(SkiaGpuTraceMemoryDump); | 116 DISALLOW_COPY_AND_ASSIGN(SkiaGpuTraceMemoryDump); |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 } // namespace | 119 } // namespace |
| 120 | 120 |
| 121 OutputSurface::OutputSurface( | 121 OutputSurface::OutputSurface( |
| 122 scoped_refptr<ContextProvider> context_provider, | 122 scoped_refptr<ContextProvider> context_provider, |
| 123 scoped_refptr<ContextProvider> worker_context_provider, | 123 scoped_refptr<ContextProvider> worker_context_provider, |
| 124 #if defined(ENABLE_VULKAN) | |
| 125 scoped_refptr<VulkanContextProvider> vulkan_context_provider, | 124 scoped_refptr<VulkanContextProvider> vulkan_context_provider, |
| 126 #endif | |
| 127 std::unique_ptr<SoftwareOutputDevice> software_device) | 125 std::unique_ptr<SoftwareOutputDevice> software_device) |
| 128 : client_(NULL), | 126 : client_(NULL), |
| 129 context_provider_(std::move(context_provider)), | 127 context_provider_(std::move(context_provider)), |
| 130 worker_context_provider_(std::move(worker_context_provider)), | 128 worker_context_provider_(std::move(worker_context_provider)), |
| 131 #if defined(ENABLE_VULKAN) | |
| 132 vulkan_context_provider_(vulkan_context_provider), | 129 vulkan_context_provider_(vulkan_context_provider), |
| 133 #endif | |
| 134 software_device_(std::move(software_device)), | 130 software_device_(std::move(software_device)), |
| 135 device_scale_factor_(-1), | 131 device_scale_factor_(-1), |
| 136 has_alpha_(true), | 132 has_alpha_(true), |
| 137 external_stencil_test_enabled_(false), | 133 external_stencil_test_enabled_(false), |
| 138 weak_ptr_factory_(this) { | 134 weak_ptr_factory_(this) { |
| 139 client_thread_checker_.DetachFromThread(); | 135 client_thread_checker_.DetachFromThread(); |
| 140 } | 136 } |
| 141 | 137 |
| 142 OutputSurface::OutputSurface(scoped_refptr<ContextProvider> context_provider) | 138 OutputSurface::OutputSurface(scoped_refptr<ContextProvider> context_provider) |
| 143 : OutputSurface(std::move(context_provider), | 139 : OutputSurface(std::move(context_provider), |
| 144 nullptr, | 140 nullptr, |
| 145 #if defined(ENABLE_VULKAN) | |
| 146 nullptr, | 141 nullptr, |
| 147 #endif | |
| 148 nullptr) { | 142 nullptr) { |
| 149 } | 143 } |
| 150 | 144 |
| 151 OutputSurface::OutputSurface( | 145 OutputSurface::OutputSurface( |
| 152 scoped_refptr<ContextProvider> context_provider, | 146 scoped_refptr<ContextProvider> context_provider, |
| 153 scoped_refptr<ContextProvider> worker_context_provider) | 147 scoped_refptr<ContextProvider> worker_context_provider) |
| 154 : OutputSurface(std::move(context_provider), | 148 : OutputSurface(std::move(context_provider), |
| 155 std::move(worker_context_provider), | 149 std::move(worker_context_provider), |
| 156 #if defined(ENABLE_VULKAN) | |
| 157 nullptr, | 150 nullptr, |
| 158 #endif | |
| 159 nullptr) { | 151 nullptr) { |
| 160 } | 152 } |
| 161 | 153 |
| 162 #if defined(ENABLE_VULKAN) | |
| 163 OutputSurface::OutputSurface( | |
| 164 scoped_refptr<VulkanContextProvider> vulkan_context_provider) | |
| 165 : OutputSurface(nullptr, | |
| 166 nullptr, | |
| 167 std::move(vulkan_context_provider), | |
| 168 nullptr) {} | |
| 169 #endif | |
| 170 | |
| 171 OutputSurface::OutputSurface( | 154 OutputSurface::OutputSurface( |
| 172 std::unique_ptr<SoftwareOutputDevice> software_device) | 155 std::unique_ptr<SoftwareOutputDevice> software_device) |
| 173 : OutputSurface(nullptr, | 156 : OutputSurface(nullptr, |
| 174 nullptr, | 157 nullptr, |
| 175 #if defined(ENABLE_VULKAN) | |
| 176 nullptr, | 158 nullptr, |
| 177 #endif | |
| 178 std::move(software_device)) { | 159 std::move(software_device)) { |
| 179 } | 160 } |
| 180 | 161 |
| 181 OutputSurface::OutputSurface( | 162 OutputSurface::OutputSurface( |
| 182 scoped_refptr<ContextProvider> context_provider, | 163 scoped_refptr<ContextProvider> context_provider, |
| 183 std::unique_ptr<SoftwareOutputDevice> software_device) | 164 std::unique_ptr<SoftwareOutputDevice> software_device) |
| 184 : OutputSurface(std::move(context_provider), | 165 : OutputSurface(std::move(context_provider), |
| 185 nullptr, | 166 nullptr, |
| 186 #if defined(ENABLE_VULKAN) | |
| 187 nullptr, | 167 nullptr, |
| 188 #endif | |
| 189 std::move(software_device)) { | 168 std::move(software_device)) { |
| 190 } | 169 } |
| 191 | 170 |
| 192 // Forwarded to OutputSurfaceClient | 171 // Forwarded to OutputSurfaceClient |
| 193 void OutputSurface::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { | 172 void OutputSurface::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
| 194 TRACE_EVENT0("cc", "OutputSurface::SetNeedsRedrawRect"); | 173 TRACE_EVENT0("cc", "OutputSurface::SetNeedsRedrawRect"); |
| 195 client_->SetNeedsRedrawRect(damage_rect); | 174 client_->SetNeedsRedrawRect(damage_rect); |
| 196 } | 175 } |
| 197 | 176 |
| 198 void OutputSurface::ReclaimResources(const CompositorFrameAck* ack) { | 177 void OutputSurface::ReclaimResources(const CompositorFrameAck* ack) { |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 if (context_provider_.get()) { | 361 if (context_provider_.get()) { |
| 383 context_provider_->SetLostContextCallback( | 362 context_provider_->SetLostContextCallback( |
| 384 ContextProvider::LostContextCallback()); | 363 ContextProvider::LostContextCallback()); |
| 385 } | 364 } |
| 386 context_provider_ = nullptr; | 365 context_provider_ = nullptr; |
| 387 client_ = nullptr; | 366 client_ = nullptr; |
| 388 weak_ptr_factory_.InvalidateWeakPtrs(); | 367 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 389 } | 368 } |
| 390 | 369 |
| 391 } // namespace cc | 370 } // namespace cc |
| OLD | NEW |