| 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/frame_swap_message_queue.h" | 5 #include "content/renderer/gpu/frame_swap_message_queue.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 105 } |
| 106 | 106 |
| 107 private: | 107 private: |
| 108 std::vector<std::unique_ptr<IPC::Message>> queue_; | 108 std::vector<std::unique_ptr<IPC::Message>> queue_; |
| 109 | 109 |
| 110 DISALLOW_COPY_AND_ASSIGN(SwapQueue); | 110 DISALLOW_COPY_AND_ASSIGN(SwapQueue); |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 } // namespace | 113 } // namespace |
| 114 | 114 |
| 115 FrameSwapMessageQueue::FrameSwapMessageQueue() | 115 FrameSwapMessageQueue::FrameSwapMessageQueue(int32_t routing_id) |
| 116 : visual_state_queue_(new VisualStateQueue()), | 116 : visual_state_queue_(new VisualStateQueue()), |
| 117 swap_queue_(new SwapQueue()) { | 117 swap_queue_(new SwapQueue()), |
| 118 routing_id_(routing_id) { |
| 119 DETACH_FROM_THREAD(impl_thread_checker_); |
| 118 } | 120 } |
| 119 | 121 |
| 120 FrameSwapMessageQueue::~FrameSwapMessageQueue() { | 122 FrameSwapMessageQueue::~FrameSwapMessageQueue() { |
| 121 } | 123 } |
| 122 | 124 |
| 123 bool FrameSwapMessageQueue::Empty() const { | 125 bool FrameSwapMessageQueue::Empty() const { |
| 124 base::AutoLock lock(lock_); | 126 base::AutoLock lock(lock_); |
| 125 return next_drain_messages_.empty() && visual_state_queue_->Empty() && | 127 return next_drain_messages_.empty() && visual_state_queue_->Empty() && |
| 126 swap_queue_->Empty(); | 128 swap_queue_->Empty(); |
| 127 } | 129 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 for (const auto& msg : *source) { | 205 for (const auto& msg : *source) { |
| 204 dest->push_back(*msg.get()); | 206 dest->push_back(*msg.get()); |
| 205 } | 207 } |
| 206 source->clear(); | 208 source->clear(); |
| 207 } | 209 } |
| 208 | 210 |
| 209 uint32_t FrameSwapMessageQueue::AllocateFrameToken() { | 211 uint32_t FrameSwapMessageQueue::AllocateFrameToken() { |
| 210 return ++last_used_frame_token_; | 212 return ++last_used_frame_token_; |
| 211 } | 213 } |
| 212 | 214 |
| 215 void FrameSwapMessageQueue::NotifyFramesAreDiscarded( |
| 216 bool frames_are_discarded) { |
| 217 DCHECK_CALLED_ON_VALID_THREAD(impl_thread_checker_); |
| 218 frames_are_discarded_ = frames_are_discarded; |
| 219 } |
| 220 |
| 221 bool FrameSwapMessageQueue::AreFramesDiscarded() { |
| 222 DCHECK_CALLED_ON_VALID_THREAD(impl_thread_checker_); |
| 223 return frames_are_discarded_; |
| 224 } |
| 225 |
| 213 } // namespace content | 226 } // namespace content |
| OLD | NEW |