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

Side by Side Diff: cc/trees/remote_channel_main.cc

Issue 1840843005: blimp: Add logging for compositor and render widget feature. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Haibin's comments. Created 4 years, 8 months 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "cc/trees/remote_channel_main.h" 5 #include "cc/trees/remote_channel_main.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "cc/proto/base_conversions.h" 8 #include "cc/proto/base_conversions.h"
9 #include "cc/proto/compositor_message.pb.h" 9 #include "cc/proto/compositor_message.pb.h"
10 #include "cc/proto/compositor_message_to_impl.pb.h" 10 #include "cc/proto/compositor_message_to_impl.pb.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 void RemoteChannelMain::SetDeferCommitsOnImpl(bool defer_commits) { 77 void RemoteChannelMain::SetDeferCommitsOnImpl(bool defer_commits) {
78 proto::CompositorMessage proto; 78 proto::CompositorMessage proto;
79 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl(); 79 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl();
80 to_impl_proto->set_message_type( 80 to_impl_proto->set_message_type(
81 proto::CompositorMessageToImpl::SET_DEFER_COMMITS); 81 proto::CompositorMessageToImpl::SET_DEFER_COMMITS);
82 proto::SetDeferCommits* defer_commits_message = 82 proto::SetDeferCommits* defer_commits_message =
83 to_impl_proto->mutable_defer_commits_message(); 83 to_impl_proto->mutable_defer_commits_message();
84 defer_commits_message->set_defer_commits(defer_commits); 84 defer_commits_message->set_defer_commits(defer_commits);
85 85
86 VLOG(1) << "Sending defer commits: " << defer_commits << " to client.";
86 SendMessageProto(proto); 87 SendMessageProto(proto);
87 } 88 }
88 89
89 void RemoteChannelMain::FinishAllRenderingOnImpl(CompletionEvent* completion) { 90 void RemoteChannelMain::FinishAllRenderingOnImpl(CompletionEvent* completion) {
90 completion->Signal(); 91 completion->Signal();
91 } 92 }
92 93
93 void RemoteChannelMain::SetVisibleOnImpl(bool visible) { 94 void RemoteChannelMain::SetVisibleOnImpl(bool visible) {
94 NOTIMPLEMENTED() << "Visibility is not controlled by the server"; 95 NOTIMPLEMENTED() << "Visibility is not controlled by the server";
95 } 96 }
(...skipping 15 matching lines...) Expand all
111 112
112 void RemoteChannelMain::SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) { 113 void RemoteChannelMain::SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) {
113 proto::CompositorMessage proto; 114 proto::CompositorMessage proto;
114 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl(); 115 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl();
115 to_impl_proto->set_message_type( 116 to_impl_proto->set_message_type(
116 proto::CompositorMessageToImpl::SET_NEEDS_REDRAW); 117 proto::CompositorMessageToImpl::SET_NEEDS_REDRAW);
117 proto::SetNeedsRedraw* set_needs_redraw_message = 118 proto::SetNeedsRedraw* set_needs_redraw_message =
118 to_impl_proto->mutable_set_needs_redraw_message(); 119 to_impl_proto->mutable_set_needs_redraw_message();
119 RectToProto(damage_rect, set_needs_redraw_message->mutable_damaged_rect()); 120 RectToProto(damage_rect, set_needs_redraw_message->mutable_damaged_rect());
120 121
122 VLOG(1) << "Sending redraw request to client.";
121 SendMessageProto(proto); 123 SendMessageProto(proto);
122 124
123 // The client will not inform us when the frame buffers are swapped. 125 // The client will not inform us when the frame buffers are swapped.
124 MainThreadTaskRunner()->PostTask( 126 MainThreadTaskRunner()->PostTask(
125 FROM_HERE, base::Bind(&RemoteChannelMain::DidCompleteSwapBuffers, 127 FROM_HERE, base::Bind(&RemoteChannelMain::DidCompleteSwapBuffers,
126 weak_factory_.GetWeakPtr())); 128 weak_factory_.GetWeakPtr()));
127 } 129 }
128 130
129 void RemoteChannelMain::SetNeedsCommitOnImpl() { 131 void RemoteChannelMain::SetNeedsCommitOnImpl() {
130 proto::CompositorMessage proto; 132 proto::CompositorMessage proto;
131 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl(); 133 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl();
132 to_impl_proto->set_message_type( 134 to_impl_proto->set_message_type(
133 proto::CompositorMessageToImpl::SET_NEEDS_COMMIT); 135 proto::CompositorMessageToImpl::SET_NEEDS_COMMIT);
134 136
137 VLOG(1) << "Sending commit request to client.";
135 SendMessageProto(proto); 138 SendMessageProto(proto);
136 } 139 }
137 140
138 void RemoteChannelMain::BeginMainFrameAbortedOnImpl( 141 void RemoteChannelMain::BeginMainFrameAbortedOnImpl(
139 CommitEarlyOutReason reason, 142 CommitEarlyOutReason reason,
140 base::TimeTicks main_thread_start_time) { 143 base::TimeTicks main_thread_start_time) {
141 proto::CompositorMessage proto; 144 proto::CompositorMessage proto;
142 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl(); 145 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl();
143 to_impl_proto->set_message_type( 146 to_impl_proto->set_message_type(
144 proto::CompositorMessageToImpl::BEGIN_MAIN_FRAME_ABORTED); 147 proto::CompositorMessageToImpl::BEGIN_MAIN_FRAME_ABORTED);
145 proto::BeginMainFrameAborted* begin_main_frame_aborted_message = 148 proto::BeginMainFrameAborted* begin_main_frame_aborted_message =
146 to_impl_proto->mutable_begin_main_frame_aborted_message(); 149 to_impl_proto->mutable_begin_main_frame_aborted_message();
147 CommitEarlyOutReasonToProtobuf( 150 CommitEarlyOutReasonToProtobuf(
148 reason, begin_main_frame_aborted_message->mutable_reason()); 151 reason, begin_main_frame_aborted_message->mutable_reason());
149 152
153 VLOG(1) << "Sending BeginMainFrameAborted message to client with reason: "
154 << CommitEarlyOutReasonToString(reason);
150 SendMessageProto(proto); 155 SendMessageProto(proto);
151 } 156 }
152 157
153 void RemoteChannelMain::StartCommitOnImpl( 158 void RemoteChannelMain::StartCommitOnImpl(
154 CompletionEvent* completion, 159 CompletionEvent* completion,
155 LayerTreeHost* layer_tree_host, 160 LayerTreeHost* layer_tree_host,
156 base::TimeTicks main_thread_start_time, 161 base::TimeTicks main_thread_start_time,
157 bool hold_commit_for_activation) { 162 bool hold_commit_for_activation) {
158 proto::CompositorMessage proto; 163 proto::CompositorMessage proto;
159 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl(); 164 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl();
160 to_impl_proto->set_message_type(proto::CompositorMessageToImpl::START_COMMIT); 165 to_impl_proto->set_message_type(proto::CompositorMessageToImpl::START_COMMIT);
161 proto::StartCommit* start_commit_message = 166 proto::StartCommit* start_commit_message =
162 to_impl_proto->mutable_start_commit_message(); 167 to_impl_proto->mutable_start_commit_message();
163 layer_tree_host->ToProtobufForCommit( 168 layer_tree_host->ToProtobufForCommit(
164 start_commit_message->mutable_layer_tree_host()); 169 start_commit_message->mutable_layer_tree_host());
165 170
171 VLOG(1) << "Sending commit message to client. Commit bytes size: "
172 << proto.ByteSize();
166 SendMessageProto(proto); 173 SendMessageProto(proto);
167 174
168 // In order to avoid incurring the overhead for the client to send us a 175 // In order to avoid incurring the overhead for the client to send us a
169 // message for when a frame to be committed is drawn we inform the embedder 176 // message for when a frame to be committed is drawn we inform the embedder
170 // that the draw was successful immediately after sending the commit message. 177 // that the draw was successful immediately after sending the commit message.
171 // Since the compositing state may be used by the embedder to throttle 178 // Since the compositing state may be used by the embedder to throttle
172 // commit/draw requests, it is better to allow them to propagate rather than 179 // commit/draw requests, it is better to allow them to propagate rather than
173 // incurring a round-trip to get Acks for draw from the client for each frame. 180 // incurring a round-trip to get Acks for draw from the client for each frame.
174 181
175 // This is done as a separate PostTask to ensure that these calls run after 182 // This is done as a separate PostTask to ensure that these calls run after
(...skipping 14 matching lines...) Expand all
190 proto::CompositorMessage proto; 197 proto::CompositorMessage proto;
191 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl(); 198 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl();
192 to_impl_proto->set_message_type( 199 to_impl_proto->set_message_type(
193 proto::CompositorMessageToImpl::INITIALIZE_IMPL); 200 proto::CompositorMessageToImpl::INITIALIZE_IMPL);
194 proto::InitializeImpl* initialize_impl_proto = 201 proto::InitializeImpl* initialize_impl_proto =
195 to_impl_proto->mutable_initialize_impl_message(); 202 to_impl_proto->mutable_initialize_impl_message();
196 proto::LayerTreeSettings* settings_proto = 203 proto::LayerTreeSettings* settings_proto =
197 initialize_impl_proto->mutable_layer_tree_settings(); 204 initialize_impl_proto->mutable_layer_tree_settings();
198 layer_tree_host->settings().ToProtobuf(settings_proto); 205 layer_tree_host->settings().ToProtobuf(settings_proto);
199 206
207 VLOG(1) << "Sending initialize message to client";
200 SendMessageProto(proto); 208 SendMessageProto(proto);
201 initialized_ = true; 209 initialized_ = true;
202 } 210 }
203 211
204 void RemoteChannelMain::SynchronouslyCloseImpl() { 212 void RemoteChannelMain::SynchronouslyCloseImpl() {
205 DCHECK(initialized_); 213 DCHECK(initialized_);
206 proto::CompositorMessage proto; 214 proto::CompositorMessage proto;
207 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl(); 215 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl();
208 to_impl_proto->set_message_type(proto::CompositorMessageToImpl::CLOSE_IMPL); 216 to_impl_proto->set_message_type(proto::CompositorMessageToImpl::CLOSE_IMPL);
209 217
218 VLOG(1) << "Sending close message to client.";
210 SendMessageProto(proto); 219 SendMessageProto(proto);
211 initialized_ = false; 220 initialized_ = false;
212 } 221 }
213 222
214 void RemoteChannelMain::SendMessageProto( 223 void RemoteChannelMain::SendMessageProto(
215 const proto::CompositorMessage& proto) { 224 const proto::CompositorMessage& proto) {
216 remote_proto_channel_->SendCompositorProto(proto); 225 remote_proto_channel_->SendCompositorProto(proto);
217 } 226 }
218 227
219 void RemoteChannelMain::HandleProto( 228 void RemoteChannelMain::HandleProto(
220 const proto::CompositorMessageToMain& proto) { 229 const proto::CompositorMessageToMain& proto) {
221 DCHECK(proto.has_message_type()); 230 DCHECK(proto.has_message_type());
222 231
223 switch (proto.message_type()) { 232 switch (proto.message_type()) {
224 case proto::CompositorMessageToMain::UNKNOWN: 233 case proto::CompositorMessageToMain::UNKNOWN:
225 NOTIMPLEMENTED() << "Ignoring message proto of unknown type"; 234 NOTIMPLEMENTED() << "Ignoring message proto of unknown type";
226 break; 235 break;
227 case proto::CompositorMessageToMain::BEGIN_MAIN_FRAME: { 236 case proto::CompositorMessageToMain::BEGIN_MAIN_FRAME: {
237 VLOG(1) << "Received BeginMainFrame request from client.";
228 const proto::BeginMainFrame& begin_main_frame_message = 238 const proto::BeginMainFrame& begin_main_frame_message =
229 proto.begin_main_frame_message(); 239 proto.begin_main_frame_message();
230 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state; 240 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state;
231 begin_main_frame_state.reset(new BeginMainFrameAndCommitState); 241 begin_main_frame_state.reset(new BeginMainFrameAndCommitState);
232 begin_main_frame_state->FromProtobuf( 242 begin_main_frame_state->FromProtobuf(
233 begin_main_frame_message.begin_main_frame_state()); 243 begin_main_frame_message.begin_main_frame_state());
234 proxy_main_->BeginMainFrame(std::move(begin_main_frame_state)); 244 proxy_main_->BeginMainFrame(std::move(begin_main_frame_state));
235 } break; 245 } break;
236 } 246 }
237 } 247 }
238 248
239 void RemoteChannelMain::DidCommitAndDrawFrame() { 249 void RemoteChannelMain::DidCommitAndDrawFrame() {
240 proxy_main_->DidCommitAndDrawFrame(); 250 proxy_main_->DidCommitAndDrawFrame();
241 DidCompleteSwapBuffers(); 251 DidCompleteSwapBuffers();
242 } 252 }
243 253
244 void RemoteChannelMain::DidCompleteSwapBuffers() { 254 void RemoteChannelMain::DidCompleteSwapBuffers() {
245 proxy_main_->DidCompleteSwapBuffers(); 255 proxy_main_->DidCompleteSwapBuffers();
246 } 256 }
247 257
248 base::SingleThreadTaskRunner* RemoteChannelMain::MainThreadTaskRunner() const { 258 base::SingleThreadTaskRunner* RemoteChannelMain::MainThreadTaskRunner() const {
249 return task_runner_provider_->MainThreadTaskRunner(); 259 return task_runner_provider_->MainThreadTaskRunner();
250 } 260 }
251 261
252 } // namespace cc 262 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698