Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(758)

Side by Side Diff: content/renderer/gpu/queue_message_swap_promise.cc

Issue 2580493002: Splitting DidSwap in cc::SwapPromise into WillSwap and DidSwap (Closed)
Patch Set: remove blank line Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 std::vector<std::unique_ptr<IPC::Message>> messages_to_deliver; 50 std::vector<std::unique_ptr<IPC::Message>> messages_to_deliver;
51 std::unique_ptr<FrameSwapMessageQueue::SendMessageScope> 51 std::unique_ptr<FrameSwapMessageQueue::SendMessageScope>
52 send_message_scope = message_queue_->AcquireSendMessageScope(); 52 send_message_scope = message_queue_->AcquireSendMessageScope();
53 message_queue_->DrainMessages(&messages_to_deliver); 53 message_queue_->DrainMessages(&messages_to_deliver);
54 for (auto& message : messages_to_deliver) 54 for (auto& message : messages_to_deliver)
55 RenderThread::Get()->Send(message.release()); 55 RenderThread::Get()->Send(message.release());
56 PromiseCompleted(); 56 PromiseCompleted();
57 } 57 }
58 } 58 }
59 59
60 void QueueMessageSwapPromise::DidSwap(cc::CompositorFrameMetadata* metadata) { 60 void QueueMessageSwapPromise::WillSwap(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::DidSwap() {}
70
69 cc::SwapPromise::DidNotSwapAction QueueMessageSwapPromise::DidNotSwap( 71 cc::SwapPromise::DidNotSwapAction QueueMessageSwapPromise::DidNotSwap(
70 DidNotSwapReason reason) { 72 DidNotSwapReason reason) {
71 #if DCHECK_IS_ON() 73 #if DCHECK_IS_ON()
72 DCHECK(!completed_); 74 DCHECK(!completed_);
73 #endif 75 #endif
74 std::vector<std::unique_ptr<IPC::Message>> messages; 76 std::vector<std::unique_ptr<IPC::Message>> messages;
75 message_queue_->DidNotSwap(source_frame_number_, reason, &messages); 77 message_queue_->DidNotSwap(source_frame_number_, reason, &messages);
76 for (auto& msg : messages) { 78 for (auto& msg : messages) {
77 message_sender_->Send(msg.release()); 79 message_sender_->Send(msg.release());
78 } 80 }
79 PromiseCompleted(); 81 PromiseCompleted();
80 return DidNotSwapAction::BREAK_PROMISE; 82 return DidNotSwapAction::BREAK_PROMISE;
81 } 83 }
82 84
83 void QueueMessageSwapPromise::PromiseCompleted() { 85 void QueueMessageSwapPromise::PromiseCompleted() {
84 #if DCHECK_IS_ON() 86 #if DCHECK_IS_ON()
85 completed_ = true; 87 completed_ = true;
86 #endif 88 #endif
87 } 89 }
88 90
89 int64_t QueueMessageSwapPromise::TraceId() const { 91 int64_t QueueMessageSwapPromise::TraceId() const {
90 return 0; 92 return 0;
91 } 93 }
92 94
93 } // namespace content 95 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698