| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/surfaces/surface_display_output_surface.h" | 5 #include "cc/surfaces/surface_display_output_surface.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/output/compositor_frame_ack.h" | 9 #include "cc/output/compositor_frame_ack.h" |
| 10 #include "cc/surfaces/display.h" | 10 #include "cc/surfaces/display.h" |
| 11 #include "cc/surfaces/onscreen_display_client.h" | 11 #include "cc/surfaces/onscreen_display_client.h" |
| 12 #include "cc/surfaces/surface.h" | 12 #include "cc/surfaces/surface.h" |
| 13 #include "cc/surfaces/surface_manager.h" | 13 #include "cc/surfaces/surface_manager.h" |
| 14 | 14 |
| 15 namespace cc { | 15 namespace cc { |
| 16 | 16 |
| 17 SurfaceDisplayOutputSurface::SurfaceDisplayOutputSurface( | 17 SurfaceDisplayOutputSurface::SurfaceDisplayOutputSurface( |
| 18 SurfaceManager* surface_manager, | 18 SurfaceManager* surface_manager, |
| 19 SurfaceIdAllocator* allocator, | 19 SurfaceIdAllocator* allocator, |
| 20 scoped_refptr<ContextProvider> context_provider, | 20 scoped_refptr<ContextProvider> context_provider, |
| 21 scoped_refptr<ContextProvider> worker_context_provider) | 21 scoped_refptr<ContextProvider> worker_context_provider) |
| 22 : OutputSurface(std::move(context_provider), | 22 : OutputSurface(std::move(context_provider), |
| 23 std::move(worker_context_provider)), | 23 std::move(worker_context_provider), |
| 24 nullptr), |
| 24 display_client_(nullptr), | 25 display_client_(nullptr), |
| 25 factory_(surface_manager, this), | 26 factory_(surface_manager, this), |
| 26 allocator_(allocator) { | 27 allocator_(allocator) { |
| 27 factory_.set_needs_sync_points(false); | 28 factory_.set_needs_sync_points(false); |
| 28 capabilities_.delegated_rendering = true; | 29 capabilities_.delegated_rendering = true; |
| 29 capabilities_.adjust_deadline_for_parent = true; | 30 capabilities_.adjust_deadline_for_parent = true; |
| 30 capabilities_.can_force_reclaim_resources = true; | 31 capabilities_.can_force_reclaim_resources = true; |
| 31 // Display and SurfaceDisplayOutputSurface share a GL context, so sync | 32 // Display and SurfaceDisplayOutputSurface share a GL context, so sync |
| 32 // points aren't needed when passing resources between them. | 33 // points aren't needed when passing resources between them. |
| 33 capabilities_.delegated_sync_points_required = false; | 34 capabilities_.delegated_sync_points_required = false; |
| 34 } | 35 } |
| 35 | 36 |
| 36 SurfaceDisplayOutputSurface::SurfaceDisplayOutputSurface( | 37 SurfaceDisplayOutputSurface::SurfaceDisplayOutputSurface( |
| 37 SurfaceManager* surface_manager, | 38 SurfaceManager* surface_manager, |
| 38 SurfaceIdAllocator* allocator, | 39 SurfaceIdAllocator* allocator, |
| 39 scoped_refptr<VulkanContextProvider> vulkan_context_provider) | 40 scoped_refptr<VulkanContextProvider> vulkan_context_provider) |
| 40 : OutputSurface(nullptr, | 41 : OutputSurface(std::move(vulkan_context_provider)), |
| 41 nullptr, | 42 display_client_(nullptr), |
| 42 std::move(vulkan_context_provider), | |
| 43 nullptr), | |
| 44 display_client_(NULL), | |
| 45 factory_(surface_manager, this), | 43 factory_(surface_manager, this), |
| 46 allocator_(allocator) { | 44 allocator_(allocator) { |
| 47 capabilities_.delegated_rendering = true; | 45 capabilities_.delegated_rendering = true; |
| 48 capabilities_.adjust_deadline_for_parent = true; | 46 capabilities_.adjust_deadline_for_parent = true; |
| 49 capabilities_.can_force_reclaim_resources = true; | 47 capabilities_.can_force_reclaim_resources = true; |
| 50 } | 48 } |
| 51 | 49 |
| 52 SurfaceDisplayOutputSurface::~SurfaceDisplayOutputSurface() { | 50 SurfaceDisplayOutputSurface::~SurfaceDisplayOutputSurface() { |
| 53 if (HasClient()) | 51 if (HasClient()) |
| 54 DetachFromClient(); | 52 DetachFromClient(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 DCHECK(client_); | 120 DCHECK(client_); |
| 123 client_->SetBeginFrameSource(begin_frame_source); | 121 client_->SetBeginFrameSource(begin_frame_source); |
| 124 } | 122 } |
| 125 | 123 |
| 126 void SurfaceDisplayOutputSurface::SwapBuffersComplete(SurfaceDrawStatus drawn) { | 124 void SurfaceDisplayOutputSurface::SwapBuffersComplete(SurfaceDrawStatus drawn) { |
| 127 if (client_ && !display_client_->output_surface_lost()) | 125 if (client_ && !display_client_->output_surface_lost()) |
| 128 client_->DidSwapBuffersComplete(); | 126 client_->DidSwapBuffersComplete(); |
| 129 } | 127 } |
| 130 | 128 |
| 131 } // namespace cc | 129 } // namespace cc |
| OLD | NEW |