Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: ui/ozone/platform/drm/gpu/drm_window.cc

Issue 2886503002: Convert additional ozone/drm callbacks to OnceCallback (Closed)
Patch Set: fixed nit Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_window.h ('k') | ui/ozone/platform/drm/gpu/drm_window_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/ozone/platform/drm/gpu/drm_window.h" 5 #include "ui/ozone/platform/drm/gpu/drm_window.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 111
112 void DrmWindow::MoveCursor(const gfx::Point& location) { 112 void DrmWindow::MoveCursor(const gfx::Point& location) {
113 cursor_location_ = location; 113 cursor_location_ = location;
114 114
115 if (controller_) 115 if (controller_)
116 controller_->MoveCursor(location); 116 controller_->MoveCursor(location);
117 } 117 }
118 118
119 void DrmWindow::SchedulePageFlip(const std::vector<OverlayPlane>& planes, 119 void DrmWindow::SchedulePageFlip(const std::vector<OverlayPlane>& planes,
120 const SwapCompletionCallback& callback) { 120 SwapCompletionOnceCallback callback) {
121 if (controller_) { 121 if (controller_) {
122 const DrmDevice* drm = controller_->GetAllocationDrmDevice().get(); 122 const DrmDevice* drm = controller_->GetAllocationDrmDevice().get();
123 for (const auto& plane : planes) { 123 for (const auto& plane : planes) {
124 if (plane.buffer && plane.buffer->GetDrmDevice() != drm) { 124 if (plane.buffer && plane.buffer->GetDrmDevice() != drm) {
125 // Although |force_buffer_reallocation_| is set to true during window 125 // Although |force_buffer_reallocation_| is set to true during window
126 // bounds update, this may still be needed because of in-flight buffers. 126 // bounds update, this may still be needed because of in-flight buffers.
127 force_buffer_reallocation_ = true; 127 force_buffer_reallocation_ = true;
128 break; 128 break;
129 } 129 }
130 } 130 }
131 } 131 }
132 132
133 if (force_buffer_reallocation_) { 133 if (force_buffer_reallocation_) {
134 force_buffer_reallocation_ = false; 134 force_buffer_reallocation_ = false;
135 callback.Run(gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS); 135 std::move(callback).Run(gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS);
136 return; 136 return;
137 } 137 }
138 138
139 last_submitted_planes_ = 139 last_submitted_planes_ =
140 overlay_validator_->PrepareBuffersForPageFlip(planes); 140 overlay_validator_->PrepareBuffersForPageFlip(planes);
141 141
142 if (!controller_) { 142 if (!controller_) {
143 callback.Run(gfx::SwapResult::SWAP_ACK); 143 std::move(callback).Run(gfx::SwapResult::SWAP_ACK);
144 return; 144 return;
145 } 145 }
146 146
147 controller_->SchedulePageFlip(last_submitted_planes_, callback); 147 controller_->SchedulePageFlip(last_submitted_planes_, std::move(callback));
148 } 148 }
149 149
150 std::vector<OverlayCheck_Params> DrmWindow::TestPageFlip( 150 std::vector<OverlayCheck_Params> DrmWindow::TestPageFlip(
151 const std::vector<OverlayCheck_Params>& overlay_params) { 151 const std::vector<OverlayCheck_Params>& overlay_params) {
152 return overlay_validator_->TestPageFlip(overlay_params, 152 return overlay_validator_->TestPageFlip(overlay_params,
153 last_submitted_planes_); 153 last_submitted_planes_);
154 } 154 }
155 155
156 const OverlayPlane* DrmWindow::GetLastModesetBuffer() { 156 const OverlayPlane* DrmWindow::GetLastModesetBuffer() {
157 return OverlayPlane::GetPrimaryPlane(last_submitted_planes_); 157 return OverlayPlane::GetPrimaryPlane(last_submitted_planes_);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 if (!cursor_buffers_[i]->Initialize( 246 if (!cursor_buffers_[i]->Initialize(
247 info, false /* should_register_framebuffer */)) { 247 info, false /* should_register_framebuffer */)) {
248 LOG(FATAL) << "Failed to initialize cursor buffer"; 248 LOG(FATAL) << "Failed to initialize cursor buffer";
249 return; 249 return;
250 } 250 }
251 } 251 }
252 } 252 }
253 } 253 }
254 254
255 } // namespace ui 255 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_window.h ('k') | ui/ozone/platform/drm/gpu/drm_window_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698