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 "services/ui/surfaces/direct_output_surface_ozone.h" | 5 #include "services/ui/surfaces/direct_output_surface_ozone.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 context_provider->SetSwapBuffersCompletionCallback( | 55 context_provider->SetSwapBuffersCompletionCallback( |
56 base::Bind(&DirectOutputSurfaceOzone::OnGpuSwapBuffersCompleted, | 56 base::Bind(&DirectOutputSurfaceOzone::OnGpuSwapBuffersCompleted, |
57 base::Unretained(this))); | 57 base::Unretained(this))); |
58 } | 58 } |
59 | 59 |
60 DirectOutputSurfaceOzone::~DirectOutputSurfaceOzone() { | 60 DirectOutputSurfaceOzone::~DirectOutputSurfaceOzone() { |
61 // TODO(rjkroege): Support cleanup. | 61 // TODO(rjkroege): Support cleanup. |
62 } | 62 } |
63 | 63 |
64 bool DirectOutputSurfaceOzone::BindToClient(cc::OutputSurfaceClient* client) { | 64 void DirectOutputSurfaceOzone::BindToClient(cc::OutputSurfaceClient* client) { |
65 if (!cc::OutputSurface::BindToClient(client)) | 65 DCHECK(client); |
66 return false; | 66 DCHECK(!client_); |
67 | 67 client_ = client; |
68 if (capabilities_.uses_default_gl_framebuffer) { | |
69 capabilities_.flipped_output_surface = | |
70 context_provider()->ContextCapabilities().flips_vertically; | |
71 } | |
72 return true; | |
73 } | 68 } |
74 | 69 |
75 void DirectOutputSurfaceOzone::EnsureBackbuffer() {} | 70 void DirectOutputSurfaceOzone::EnsureBackbuffer() {} |
76 | 71 |
77 void DirectOutputSurfaceOzone::DiscardBackbuffer() { | 72 void DirectOutputSurfaceOzone::DiscardBackbuffer() { |
78 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM(); | 73 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM(); |
79 } | 74 } |
80 | 75 |
81 void DirectOutputSurfaceOzone::BindFramebuffer() { | 76 void DirectOutputSurfaceOzone::BindFramebuffer() { |
82 DCHECK(buffer_queue_); | 77 DCHECK(buffer_queue_); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 167 } |
173 | 168 |
174 buffer_queue_->PageFlipComplete(); | 169 buffer_queue_->PageFlipComplete(); |
175 client_->DidReceiveSwapBuffersAck(); | 170 client_->DidReceiveSwapBuffersAck(); |
176 | 171 |
177 if (force_swap) | 172 if (force_swap) |
178 client_->SetNeedsRedrawRect(gfx::Rect(swap_size_)); | 173 client_->SetNeedsRedrawRect(gfx::Rect(swap_size_)); |
179 } | 174 } |
180 | 175 |
181 } // namespace ui | 176 } // namespace ui |
OLD | NEW |