| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 void QueueMessageSwapPromise::DidSwap(cc::CompositorFrameMetadata* metadata) { | 60 void QueueMessageSwapPromise::DidSwap(cc::CompositorFrameMetadata* metadata) { |
| 61 #if DCHECK_IS_ON() | 61 #if DCHECK_IS_ON() |
| 62 DCHECK(!completed_); | 62 DCHECK(!completed_); |
| 63 #endif | 63 #endif |
| 64 message_queue_->DidSwap(source_frame_number_); | 64 message_queue_->DidSwap(source_frame_number_); |
| 65 // The OutputSurface will take care of the Drain+Send. | 65 // The OutputSurface will take care of the Drain+Send. |
| 66 PromiseCompleted(); | 66 PromiseCompleted(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void QueueMessageSwapPromise::DidNotSwap(DidNotSwapReason reason) { | 69 bool QueueMessageSwapPromise::DidNotSwap(DidNotSwapReason reason) { |
| 70 #if DCHECK_IS_ON() | 70 #if DCHECK_IS_ON() |
| 71 DCHECK(!completed_); | 71 DCHECK(!completed_); |
| 72 #endif | 72 #endif |
| 73 std::vector<std::unique_ptr<IPC::Message>> messages; | 73 std::vector<std::unique_ptr<IPC::Message>> messages; |
| 74 message_queue_->DidNotSwap(source_frame_number_, reason, &messages); | 74 message_queue_->DidNotSwap(source_frame_number_, reason, &messages); |
| 75 for (auto& msg : messages) { | 75 for (auto& msg : messages) { |
| 76 message_sender_->Send(msg.release()); | 76 message_sender_->Send(msg.release()); |
| 77 } | 77 } |
| 78 PromiseCompleted(); | 78 PromiseCompleted(); |
| 79 return false; |
| 79 } | 80 } |
| 80 | 81 |
| 81 void QueueMessageSwapPromise::PromiseCompleted() { | 82 void QueueMessageSwapPromise::PromiseCompleted() { |
| 82 #if DCHECK_IS_ON() | 83 #if DCHECK_IS_ON() |
| 83 completed_ = true; | 84 completed_ = true; |
| 84 #endif | 85 #endif |
| 85 } | 86 } |
| 86 | 87 |
| 87 int64_t QueueMessageSwapPromise::TraceId() const { | 88 int64_t QueueMessageSwapPromise::TraceId() const { |
| 88 return 0; | 89 return 0; |
| 89 } | 90 } |
| 90 | 91 |
| 91 } // namespace content | 92 } // namespace content |
| OLD | NEW |