| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "remoting/client/plugin/pepper_video_renderer_2d.h" | 5 #include "remoting/client/plugin/pepper_video_renderer_2d.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> |
| 10 |
| 9 #include "base/bind.h" | 11 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 12 #include "base/callback_helpers.h" |
| 11 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 12 #include "base/task_runner_util.h" | 14 #include "base/task_runner_util.h" |
| 13 #include "ppapi/cpp/completion_callback.h" | 15 #include "ppapi/cpp/completion_callback.h" |
| 14 #include "ppapi/cpp/image_data.h" | 16 #include "ppapi/cpp/image_data.h" |
| 15 #include "ppapi/cpp/instance.h" | 17 #include "ppapi/cpp/instance.h" |
| 16 #include "ppapi/cpp/point.h" | 18 #include "ppapi/cpp/point.h" |
| 17 #include "ppapi/cpp/rect.h" | 19 #include "ppapi/cpp/rect.h" |
| 18 #include "ppapi/cpp/size.h" | 20 #include "ppapi/cpp/size.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 196 |
| 195 if (flush_pending_ || !need_flush_) | 197 if (flush_pending_ || !need_flush_) |
| 196 return; | 198 return; |
| 197 | 199 |
| 198 need_flush_ = false; | 200 need_flush_ = false; |
| 199 | 201 |
| 200 // Move callbacks from |pending_frames_done_callbacks_| to | 202 // Move callbacks from |pending_frames_done_callbacks_| to |
| 201 // |flushing_frames_done_callbacks_| so the callbacks are called when flush is | 203 // |flushing_frames_done_callbacks_| so the callbacks are called when flush is |
| 202 // finished. | 204 // finished. |
| 203 DCHECK(flushing_frames_done_callbacks_.empty()); | 205 DCHECK(flushing_frames_done_callbacks_.empty()); |
| 204 flushing_frames_done_callbacks_ = pending_frames_done_callbacks_.Pass(); | 206 flushing_frames_done_callbacks_ = std::move(pending_frames_done_callbacks_); |
| 205 | 207 |
| 206 // Flush the updated areas to the screen. | 208 // Flush the updated areas to the screen. |
| 207 int error = graphics2d_.Flush( | 209 int error = graphics2d_.Flush( |
| 208 callback_factory_.NewCallback(&PepperVideoRenderer2D::OnFlushDone)); | 210 callback_factory_.NewCallback(&PepperVideoRenderer2D::OnFlushDone)); |
| 209 CHECK(error == PP_OK_COMPLETIONPENDING); | 211 CHECK(error == PP_OK_COMPLETIONPENDING); |
| 210 flush_pending_ = true; | 212 flush_pending_ = true; |
| 211 } | 213 } |
| 212 | 214 |
| 213 void PepperVideoRenderer2D::OnFlushDone(int result) { | 215 void PepperVideoRenderer2D::OnFlushDone(int result) { |
| 214 DCHECK(thread_checker_.CalledOnValidThread()); | 216 DCHECK(thread_checker_.CalledOnValidThread()); |
| 215 | 217 |
| 216 DCHECK(flush_pending_); | 218 DCHECK(flush_pending_); |
| 217 flush_pending_ = false; | 219 flush_pending_ = false; |
| 218 | 220 |
| 219 // Call all callbacks for the frames we've just flushed. | 221 // Call all callbacks for the frames we've just flushed. |
| 220 flushing_frames_done_callbacks_.clear(); | 222 flushing_frames_done_callbacks_.clear(); |
| 221 | 223 |
| 222 // Flush again if necessary. | 224 // Flush again if necessary. |
| 223 Flush(); | 225 Flush(); |
| 224 } | 226 } |
| 225 | 227 |
| 226 } // namespace remoting | 228 } // namespace remoting |
| OLD | NEW |