| 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 "content/renderer/gpu/queue_message_swap_promise.h" | 5 #include "content/renderer/gpu/queue_message_swap_promise.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "content/public/common/content_switches.h" | 8 #include "content/public/common/content_switches.h" |
| 9 #include "content/public/renderer/render_thread.h" | 9 #include "content/public/renderer/render_thread.h" |
| 10 #include "content/renderer/gpu/frame_swap_message_queue.h" | 10 #include "content/renderer/gpu/frame_swap_message_queue.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 PromiseCompleted(); | 52 PromiseCompleted(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void QueueMessageSwapPromise::DidSwap() {} | 55 void QueueMessageSwapPromise::DidSwap() {} |
| 56 | 56 |
| 57 cc::SwapPromise::DidNotSwapAction QueueMessageSwapPromise::DidNotSwap( | 57 cc::SwapPromise::DidNotSwapAction QueueMessageSwapPromise::DidNotSwap( |
| 58 DidNotSwapReason reason) { | 58 DidNotSwapReason reason) { |
| 59 #if DCHECK_IS_ON() | 59 #if DCHECK_IS_ON() |
| 60 DCHECK(!completed_); | 60 DCHECK(!completed_); |
| 61 #endif | 61 #endif |
| 62 // TODO(eseckler): Deliver messages with next ViewHostMsg_BeginFrameDidNotSwap | 62 // TODO(eseckler): Deliver messages with the next swap instead of sending |
| 63 // or ViewHostMsg_SwapCompositorFrame instead of sending them here directly. | 63 // them here directly. |
| 64 std::vector<std::unique_ptr<IPC::Message>> messages; | 64 std::vector<std::unique_ptr<IPC::Message>> messages; |
| 65 message_queue_->DidNotSwap(source_frame_number_, reason, &messages); | 65 message_queue_->DidNotSwap(source_frame_number_, reason, &messages); |
| 66 for (auto& msg : messages) { | 66 for (auto& msg : messages) { |
| 67 message_sender_->Send(msg.release()); | 67 message_sender_->Send(msg.release()); |
| 68 } | 68 } |
| 69 PromiseCompleted(); | 69 PromiseCompleted(); |
| 70 return DidNotSwapAction::BREAK_PROMISE; | 70 return DidNotSwapAction::BREAK_PROMISE; |
| 71 } | 71 } |
| 72 | 72 |
| 73 void QueueMessageSwapPromise::PromiseCompleted() { | 73 void QueueMessageSwapPromise::PromiseCompleted() { |
| 74 #if DCHECK_IS_ON() | 74 #if DCHECK_IS_ON() |
| 75 completed_ = true; | 75 completed_ = true; |
| 76 #endif | 76 #endif |
| 77 } | 77 } |
| 78 | 78 |
| 79 int64_t QueueMessageSwapPromise::TraceId() const { | 79 int64_t QueueMessageSwapPromise::TraceId() const { |
| 80 return 0; | 80 return 0; |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace content | 83 } // namespace content |
| OLD | NEW |