| 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 23 matching lines...) Expand all Loading... |
| 34 DCHECK(completed_); | 34 DCHECK(completed_); |
| 35 #endif | 35 #endif |
| 36 } | 36 } |
| 37 | 37 |
| 38 void QueueMessageSwapPromise::DidActivate() { | 38 void QueueMessageSwapPromise::DidActivate() { |
| 39 #if DCHECK_IS_ON() | 39 #if DCHECK_IS_ON() |
| 40 DCHECK(!completed_); | 40 DCHECK(!completed_); |
| 41 #endif | 41 #endif |
| 42 message_queue_->DidActivate(source_frame_number_); | 42 message_queue_->DidActivate(source_frame_number_); |
| 43 // The OutputSurface will take care of the Drain+Send. | 43 // The OutputSurface will take care of the Drain+Send. |
| 44 | |
| 45 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 46 switches::kUseRemoteCompositing)) { | |
| 47 // The remote compositing mode doesn't have an output surface, so we need to | |
| 48 // Drain+Send on activation. Also, we can't use the SyncMessageFilter, since | |
| 49 // this call is actually made on the main thread. | |
| 50 std::vector<std::unique_ptr<IPC::Message>> messages_to_deliver; | |
| 51 std::unique_ptr<FrameSwapMessageQueue::SendMessageScope> | |
| 52 send_message_scope = message_queue_->AcquireSendMessageScope(); | |
| 53 message_queue_->DrainMessages(&messages_to_deliver); | |
| 54 for (auto& message : messages_to_deliver) | |
| 55 RenderThread::Get()->Send(message.release()); | |
| 56 PromiseCompleted(); | |
| 57 } | |
| 58 } | 44 } |
| 59 | 45 |
| 60 void QueueMessageSwapPromise::WillSwap(cc::CompositorFrameMetadata* metadata) { | 46 void QueueMessageSwapPromise::WillSwap(cc::CompositorFrameMetadata* metadata) { |
| 61 #if DCHECK_IS_ON() | 47 #if DCHECK_IS_ON() |
| 62 DCHECK(!completed_); | 48 DCHECK(!completed_); |
| 63 #endif | 49 #endif |
| 64 message_queue_->DidSwap(source_frame_number_); | 50 message_queue_->DidSwap(source_frame_number_); |
| 65 // The OutputSurface will take care of the Drain+Send. | 51 // The OutputSurface will take care of the Drain+Send. |
| 66 PromiseCompleted(); | 52 PromiseCompleted(); |
| 67 } | 53 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 86 #if DCHECK_IS_ON() | 72 #if DCHECK_IS_ON() |
| 87 completed_ = true; | 73 completed_ = true; |
| 88 #endif | 74 #endif |
| 89 } | 75 } |
| 90 | 76 |
| 91 int64_t QueueMessageSwapPromise::TraceId() const { | 77 int64_t QueueMessageSwapPromise::TraceId() const { |
| 92 return 0; | 78 return 0; |
| 93 } | 79 } |
| 94 | 80 |
| 95 } // namespace content | 81 } // namespace content |
| OLD | NEW |