| 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 "ui/ozone/platform/drm/gpu/drm_surface.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_surface.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "third_party/skia/include/core/SkCanvas.h" | 10 #include "third_party/skia/include/core/SkCanvas.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 canvas->drawImageRect(pending_image_.get(), &real_damage, real_damage, NULL); | 92 canvas->drawImageRect(pending_image_.get(), &real_damage, real_damage, NULL); |
| 93 last_damage_ = pending_image_damage_; | 93 last_damage_ = pending_image_damage_; |
| 94 | 94 |
| 95 pending_image_ = nullptr; | 95 pending_image_ = nullptr; |
| 96 pending_image_damage_ = gfx::Rect(); | 96 pending_image_damage_ = gfx::Rect(); |
| 97 | 97 |
| 98 window_->QueueOverlayPlane(OverlayPlane(back_buffer_)); | 98 window_->QueueOverlayPlane(OverlayPlane(back_buffer_)); |
| 99 | 99 |
| 100 // Update our front buffer pointer. | 100 // Update our front buffer pointer. |
| 101 std::swap(front_buffer_, back_buffer_); | 101 std::swap(front_buffer_, back_buffer_); |
| 102 pending_pageflip_ = window_->SchedulePageFlip( | 102 // First set the pending flag otherwise there could be a re-entrancy issue if |
| 103 false /* is_sync */, | 103 // the callback is executed synchronously. |
| 104 base::Bind(&DrmSurface::OnPageFlip, weak_ptr_factory_.GetWeakPtr())); | 104 pending_pageflip_ = true; |
| 105 if (!window_->SchedulePageFlip(false /* is_sync */, |
| 106 base::Bind(&DrmSurface::OnPageFlip, |
| 107 weak_ptr_factory_.GetWeakPtr()))) { |
| 108 pending_pageflip_ = false; |
| 109 } |
| 105 } | 110 } |
| 106 | 111 |
| 107 void DrmSurface::OnPageFlip(gfx::SwapResult result) { | 112 void DrmSurface::OnPageFlip(gfx::SwapResult result) { |
| 108 pending_pageflip_ = false; | 113 pending_pageflip_ = false; |
| 109 if (!pending_image_) | 114 if (!pending_image_) |
| 110 return; | 115 return; |
| 111 | 116 |
| 112 SchedulePageFlip(); | 117 SchedulePageFlip(); |
| 113 } | 118 } |
| 114 | 119 |
| 115 } // namespace ui | 120 } // namespace ui |
| OLD | NEW |