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

Side by Side Diff: blimp/common/logging.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 "blimp/common/logging.h" 5 #include "blimp/common/logging.h"
6 6
7 #include <iostream> 7 #include <iostream>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 break; 126 break;
127 case NavigationMessage::RELOAD: 127 case NavigationMessage::RELOAD:
128 AddField("subtype", "RELOAD", output); 128 AddField("subtype", "RELOAD", output);
129 break; 129 break;
130 default: 130 default:
131 break; 131 break;
132 } 132 }
133 } 133 }
134 }; 134 };
135 135
136 // Logs fields from COMPOSITOR messages.
137 class CompositorLogExtractor : public LogExtractor {
138 void ExtractFields(const BlimpMessage& message,
139 LogFields* output) const override {
140 AddField("render_widget_id", message.compositor().render_widget_id(),
141 output);
142 }
143 };
144
145 // Logs fields from INPUT messages.
146 class InputLogExtractor : public LogExtractor {
147 void ExtractFields(const BlimpMessage& message,
148 LogFields* output) const override {
149 AddField("render_widget_id", message.input().render_widget_id(), output);
150 }
151 };
152
136 // Logs fields from RENDER_WIDGET messages. 153 // Logs fields from RENDER_WIDGET messages.
137 class RenderWidgetLogExtractor : public LogExtractor { 154 class RenderWidgetLogExtractor : public LogExtractor {
138 void ExtractFields(const BlimpMessage& message, 155 void ExtractFields(const BlimpMessage& message,
139 LogFields* output) const override { 156 LogFields* output) const override {
140 switch (message.render_widget().type()) { 157 switch (message.render_widget().type()) {
141 case RenderWidgetMessage::INITIALIZE: 158 case RenderWidgetMessage::INITIALIZE:
142 AddField("subtype", "INITIALIZE", output); 159 AddField("subtype", "INITIALIZE", output);
143 break; 160 break;
144 case RenderWidgetMessage::CREATED: 161 case RenderWidgetMessage::CREATED:
145 AddField("subtype", "CREATED", output); 162 AddField("subtype", "CREATED", output);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // No fields are extracted from |message|. 200 // No fields are extracted from |message|.
184 class NullLogExtractor : public LogExtractor { 201 class NullLogExtractor : public LogExtractor {
185 void ExtractFields(const BlimpMessage& message, 202 void ExtractFields(const BlimpMessage& message,
186 LogFields* output) const override {} 203 LogFields* output) const override {}
187 }; 204 };
188 205
189 } // namespace 206 } // namespace
190 207
191 BlimpMessageLogger::BlimpMessageLogger() { 208 BlimpMessageLogger::BlimpMessageLogger() {
192 AddHandler("COMPOSITOR", BlimpMessage::COMPOSITOR, 209 AddHandler("COMPOSITOR", BlimpMessage::COMPOSITOR,
193 make_scoped_ptr(new NullLogExtractor)); 210 make_scoped_ptr(new CompositorLogExtractor));
194 AddHandler("INPUT", BlimpMessage::INPUT, 211 AddHandler("INPUT", BlimpMessage::INPUT,
195 make_scoped_ptr(new NullLogExtractor)); 212 make_scoped_ptr(new InputLogExtractor));
196 AddHandler("NAVIGATION", BlimpMessage::NAVIGATION, 213 AddHandler("NAVIGATION", BlimpMessage::NAVIGATION,
197 make_scoped_ptr(new NavigationLogExtractor)); 214 make_scoped_ptr(new NavigationLogExtractor));
198 AddHandler("PROTOCOL_CONTROL", BlimpMessage::PROTOCOL_CONTROL, 215 AddHandler("PROTOCOL_CONTROL", BlimpMessage::PROTOCOL_CONTROL,
199 make_scoped_ptr(new ProtocolControlLogExtractor)); 216 make_scoped_ptr(new ProtocolControlLogExtractor));
200 AddHandler("RENDER_WIDGET", BlimpMessage::RENDER_WIDGET, 217 AddHandler("RENDER_WIDGET", BlimpMessage::RENDER_WIDGET,
201 make_scoped_ptr(new RenderWidgetLogExtractor)); 218 make_scoped_ptr(new RenderWidgetLogExtractor));
202 AddHandler("TAB_CONTROL", BlimpMessage::TAB_CONTROL, 219 AddHandler("TAB_CONTROL", BlimpMessage::TAB_CONTROL,
203 make_scoped_ptr(new TabControlLogExtractor)); 220 make_scoped_ptr(new TabControlLogExtractor));
204 } 221 }
205 222
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 } 261 }
245 *out << ">"; 262 *out << ">";
246 } 263 }
247 264
248 std::ostream& operator<<(std::ostream& out, const BlimpMessage& message) { 265 std::ostream& operator<<(std::ostream& out, const BlimpMessage& message) {
249 g_logger.Get().LogMessageToStream(message, &out); 266 g_logger.Get().LogMessageToStream(message, &out);
250 return out; 267 return out;
251 } 268 }
252 269
253 } // namespace blimp 270 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698