1/*
2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
4 * Copyright (C) 2014 University of Washington. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
19 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
25 * THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28// DO NOT EDIT THIS FILE. It is automatically generated from CombinedDomains.json
29// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
30
31#include "config.h"
32#include "InspectorFrontendDispatchers.h"
33
34#include "InspectorFrontendRouter.h"
35#include <wtf/text/CString.h>
36
37namespace Inspector {
38
39void ApplicationCacheFrontendDispatcher::applicationCacheStatusUpdated(const String& frameId, const String& manifestURL, int status)
40{
41 Ref<JSON::Object> jsonMessage = JSON::Object::create();
42 jsonMessage->setString("method"_s, "ApplicationCache.applicationCacheStatusUpdated"_s);
43 Ref<JSON::Object> paramsObject = JSON::Object::create();
44 paramsObject->setString("frameId"_s, frameId);
45 paramsObject->setString("manifestURL"_s, manifestURL);
46 paramsObject->setInteger("status"_s, status);
47 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
48
49 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
50}
51
52void ApplicationCacheFrontendDispatcher::networkStateUpdated(bool isNowOnline)
53{
54 Ref<JSON::Object> jsonMessage = JSON::Object::create();
55 jsonMessage->setString("method"_s, "ApplicationCache.networkStateUpdated"_s);
56 Ref<JSON::Object> paramsObject = JSON::Object::create();
57 paramsObject->setBoolean("isNowOnline"_s, isNowOnline);
58 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
59
60 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
61}
62
63#if ENABLE(RESOURCE_USAGE)
64void CPUProfilerFrontendDispatcher::trackingStart(double timestamp)
65{
66 Ref<JSON::Object> jsonMessage = JSON::Object::create();
67 jsonMessage->setString("method"_s, "CPUProfiler.trackingStart"_s);
68 Ref<JSON::Object> paramsObject = JSON::Object::create();
69 paramsObject->setDouble("timestamp"_s, timestamp);
70 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
71
72 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
73}
74
75void CPUProfilerFrontendDispatcher::trackingUpdate(RefPtr<Inspector::Protocol::CPUProfiler::Event> event)
76{
77 Ref<JSON::Object> jsonMessage = JSON::Object::create();
78 jsonMessage->setString("method"_s, "CPUProfiler.trackingUpdate"_s);
79 Ref<JSON::Object> paramsObject = JSON::Object::create();
80 paramsObject->setObject("event"_s, event);
81 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
82
83 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
84}
85
86void CPUProfilerFrontendDispatcher::trackingComplete(double timestamp)
87{
88 Ref<JSON::Object> jsonMessage = JSON::Object::create();
89 jsonMessage->setString("method"_s, "CPUProfiler.trackingComplete"_s);
90 Ref<JSON::Object> paramsObject = JSON::Object::create();
91 paramsObject->setDouble("timestamp"_s, timestamp);
92 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
93
94 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
95}
96#endif // ENABLE(RESOURCE_USAGE)
97
98void CSSFrontendDispatcher::mediaQueryResultChanged()
99{
100 Ref<JSON::Object> jsonMessage = JSON::Object::create();
101 jsonMessage->setString("method"_s, "CSS.mediaQueryResultChanged"_s);
102
103 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
104}
105
106void CSSFrontendDispatcher::styleSheetChanged(const String& styleSheetId)
107{
108 Ref<JSON::Object> jsonMessage = JSON::Object::create();
109 jsonMessage->setString("method"_s, "CSS.styleSheetChanged"_s);
110 Ref<JSON::Object> paramsObject = JSON::Object::create();
111 paramsObject->setString("styleSheetId"_s, styleSheetId);
112 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
113
114 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
115}
116
117void CSSFrontendDispatcher::styleSheetAdded(RefPtr<Inspector::Protocol::CSS::CSSStyleSheetHeader> header)
118{
119 Ref<JSON::Object> jsonMessage = JSON::Object::create();
120 jsonMessage->setString("method"_s, "CSS.styleSheetAdded"_s);
121 Ref<JSON::Object> paramsObject = JSON::Object::create();
122 paramsObject->setObject("header"_s, header);
123 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
124
125 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
126}
127
128void CSSFrontendDispatcher::styleSheetRemoved(const String& styleSheetId)
129{
130 Ref<JSON::Object> jsonMessage = JSON::Object::create();
131 jsonMessage->setString("method"_s, "CSS.styleSheetRemoved"_s);
132 Ref<JSON::Object> paramsObject = JSON::Object::create();
133 paramsObject->setString("styleSheetId"_s, styleSheetId);
134 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
135
136 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
137}
138
139void CanvasFrontendDispatcher::canvasAdded(RefPtr<Inspector::Protocol::Canvas::Canvas> canvas)
140{
141 Ref<JSON::Object> jsonMessage = JSON::Object::create();
142 jsonMessage->setString("method"_s, "Canvas.canvasAdded"_s);
143 Ref<JSON::Object> paramsObject = JSON::Object::create();
144 paramsObject->setObject("canvas"_s, canvas);
145 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
146
147 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
148}
149
150void CanvasFrontendDispatcher::canvasRemoved(const String& canvasId)
151{
152 Ref<JSON::Object> jsonMessage = JSON::Object::create();
153 jsonMessage->setString("method"_s, "Canvas.canvasRemoved"_s);
154 Ref<JSON::Object> paramsObject = JSON::Object::create();
155 paramsObject->setString("canvasId"_s, canvasId);
156 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
157
158 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
159}
160
161void CanvasFrontendDispatcher::canvasMemoryChanged(const String& canvasId, double memoryCost)
162{
163 Ref<JSON::Object> jsonMessage = JSON::Object::create();
164 jsonMessage->setString("method"_s, "Canvas.canvasMemoryChanged"_s);
165 Ref<JSON::Object> paramsObject = JSON::Object::create();
166 paramsObject->setString("canvasId"_s, canvasId);
167 paramsObject->setDouble("memoryCost"_s, memoryCost);
168 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
169
170 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
171}
172
173void CanvasFrontendDispatcher::extensionEnabled(const String& canvasId, const String& extension)
174{
175 Ref<JSON::Object> jsonMessage = JSON::Object::create();
176 jsonMessage->setString("method"_s, "Canvas.extensionEnabled"_s);
177 Ref<JSON::Object> paramsObject = JSON::Object::create();
178 paramsObject->setString("canvasId"_s, canvasId);
179 paramsObject->setString("extension"_s, extension);
180 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
181
182 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
183}
184
185void CanvasFrontendDispatcher::cssCanvasClientNodesChanged(const String& canvasId)
186{
187 Ref<JSON::Object> jsonMessage = JSON::Object::create();
188 jsonMessage->setString("method"_s, "Canvas.cssCanvasClientNodesChanged"_s);
189 Ref<JSON::Object> paramsObject = JSON::Object::create();
190 paramsObject->setString("canvasId"_s, canvasId);
191 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
192
193 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
194}
195
196void CanvasFrontendDispatcher::recordingStarted(const String& canvasId, Inspector::Protocol::Recording::Initiator initiator)
197{
198 Ref<JSON::Object> jsonMessage = JSON::Object::create();
199 jsonMessage->setString("method"_s, "Canvas.recordingStarted"_s);
200 Ref<JSON::Object> paramsObject = JSON::Object::create();
201 paramsObject->setString("canvasId"_s, canvasId);
202 paramsObject->setString("initiator"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(initiator));
203 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
204
205 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
206}
207
208void CanvasFrontendDispatcher::recordingProgress(const String& canvasId, RefPtr<JSON::ArrayOf<Inspector::Protocol::Recording::Frame>> frames, int bufferUsed)
209{
210 Ref<JSON::Object> jsonMessage = JSON::Object::create();
211 jsonMessage->setString("method"_s, "Canvas.recordingProgress"_s);
212 Ref<JSON::Object> paramsObject = JSON::Object::create();
213 paramsObject->setString("canvasId"_s, canvasId);
214 paramsObject->setArray("frames"_s, frames);
215 paramsObject->setInteger("bufferUsed"_s, bufferUsed);
216 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
217
218 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
219}
220
221void CanvasFrontendDispatcher::recordingFinished(const String& canvasId, RefPtr<Inspector::Protocol::Recording::Recording> recording)
222{
223 Ref<JSON::Object> jsonMessage = JSON::Object::create();
224 jsonMessage->setString("method"_s, "Canvas.recordingFinished"_s);
225 Ref<JSON::Object> paramsObject = JSON::Object::create();
226 paramsObject->setString("canvasId"_s, canvasId);
227 if (recording)
228 paramsObject->setObject("recording"_s, recording);
229 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
230
231 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
232}
233
234void CanvasFrontendDispatcher::programCreated(const String& canvasId, const String& programId)
235{
236 Ref<JSON::Object> jsonMessage = JSON::Object::create();
237 jsonMessage->setString("method"_s, "Canvas.programCreated"_s);
238 Ref<JSON::Object> paramsObject = JSON::Object::create();
239 paramsObject->setString("canvasId"_s, canvasId);
240 paramsObject->setString("programId"_s, programId);
241 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
242
243 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
244}
245
246void CanvasFrontendDispatcher::programDeleted(const String& programId)
247{
248 Ref<JSON::Object> jsonMessage = JSON::Object::create();
249 jsonMessage->setString("method"_s, "Canvas.programDeleted"_s);
250 Ref<JSON::Object> paramsObject = JSON::Object::create();
251 paramsObject->setString("programId"_s, programId);
252 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
253
254 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
255}
256
257void ConsoleFrontendDispatcher::messageAdded(RefPtr<Inspector::Protocol::Console::ConsoleMessage> message)
258{
259 Ref<JSON::Object> jsonMessage = JSON::Object::create();
260 jsonMessage->setString("method"_s, "Console.messageAdded"_s);
261 Ref<JSON::Object> paramsObject = JSON::Object::create();
262 paramsObject->setObject("message"_s, message);
263 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
264
265 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
266}
267
268void ConsoleFrontendDispatcher::messageRepeatCountUpdated(int count)
269{
270 Ref<JSON::Object> jsonMessage = JSON::Object::create();
271 jsonMessage->setString("method"_s, "Console.messageRepeatCountUpdated"_s);
272 Ref<JSON::Object> paramsObject = JSON::Object::create();
273 paramsObject->setInteger("count"_s, count);
274 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
275
276 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
277}
278
279void ConsoleFrontendDispatcher::messagesCleared()
280{
281 Ref<JSON::Object> jsonMessage = JSON::Object::create();
282 jsonMessage->setString("method"_s, "Console.messagesCleared"_s);
283
284 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
285}
286
287void ConsoleFrontendDispatcher::heapSnapshot(double timestamp, const String& snapshotData, const String* title)
288{
289 Ref<JSON::Object> jsonMessage = JSON::Object::create();
290 jsonMessage->setString("method"_s, "Console.heapSnapshot"_s);
291 Ref<JSON::Object> paramsObject = JSON::Object::create();
292 paramsObject->setDouble("timestamp"_s, timestamp);
293 paramsObject->setString("snapshotData"_s, snapshotData);
294 if (title)
295 paramsObject->setString("title"_s, *title);
296 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
297
298 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
299}
300
301void DOMFrontendDispatcher::documentUpdated()
302{
303 Ref<JSON::Object> jsonMessage = JSON::Object::create();
304 jsonMessage->setString("method"_s, "DOM.documentUpdated"_s);
305
306 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
307}
308
309void DOMFrontendDispatcher::inspect(int nodeId)
310{
311 Ref<JSON::Object> jsonMessage = JSON::Object::create();
312 jsonMessage->setString("method"_s, "DOM.inspect"_s);
313 Ref<JSON::Object> paramsObject = JSON::Object::create();
314 paramsObject->setInteger("nodeId"_s, nodeId);
315 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
316
317 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
318}
319
320void DOMFrontendDispatcher::setChildNodes(int parentId, RefPtr<JSON::ArrayOf<Inspector::Protocol::DOM::Node>> nodes)
321{
322 Ref<JSON::Object> jsonMessage = JSON::Object::create();
323 jsonMessage->setString("method"_s, "DOM.setChildNodes"_s);
324 Ref<JSON::Object> paramsObject = JSON::Object::create();
325 paramsObject->setInteger("parentId"_s, parentId);
326 paramsObject->setArray("nodes"_s, nodes);
327 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
328
329 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
330}
331
332void DOMFrontendDispatcher::attributeModified(int nodeId, const String& name, const String& value)
333{
334 Ref<JSON::Object> jsonMessage = JSON::Object::create();
335 jsonMessage->setString("method"_s, "DOM.attributeModified"_s);
336 Ref<JSON::Object> paramsObject = JSON::Object::create();
337 paramsObject->setInteger("nodeId"_s, nodeId);
338 paramsObject->setString("name"_s, name);
339 paramsObject->setString("value"_s, value);
340 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
341
342 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
343}
344
345void DOMFrontendDispatcher::attributeRemoved(int nodeId, const String& name)
346{
347 Ref<JSON::Object> jsonMessage = JSON::Object::create();
348 jsonMessage->setString("method"_s, "DOM.attributeRemoved"_s);
349 Ref<JSON::Object> paramsObject = JSON::Object::create();
350 paramsObject->setInteger("nodeId"_s, nodeId);
351 paramsObject->setString("name"_s, name);
352 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
353
354 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
355}
356
357void DOMFrontendDispatcher::inlineStyleInvalidated(RefPtr<JSON::ArrayOf<int>> nodeIds)
358{
359 Ref<JSON::Object> jsonMessage = JSON::Object::create();
360 jsonMessage->setString("method"_s, "DOM.inlineStyleInvalidated"_s);
361 Ref<JSON::Object> paramsObject = JSON::Object::create();
362 paramsObject->setArray("nodeIds"_s, nodeIds);
363 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
364
365 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
366}
367
368void DOMFrontendDispatcher::characterDataModified(int nodeId, const String& characterData)
369{
370 Ref<JSON::Object> jsonMessage = JSON::Object::create();
371 jsonMessage->setString("method"_s, "DOM.characterDataModified"_s);
372 Ref<JSON::Object> paramsObject = JSON::Object::create();
373 paramsObject->setInteger("nodeId"_s, nodeId);
374 paramsObject->setString("characterData"_s, characterData);
375 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
376
377 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
378}
379
380void DOMFrontendDispatcher::childNodeCountUpdated(int nodeId, int childNodeCount)
381{
382 Ref<JSON::Object> jsonMessage = JSON::Object::create();
383 jsonMessage->setString("method"_s, "DOM.childNodeCountUpdated"_s);
384 Ref<JSON::Object> paramsObject = JSON::Object::create();
385 paramsObject->setInteger("nodeId"_s, nodeId);
386 paramsObject->setInteger("childNodeCount"_s, childNodeCount);
387 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
388
389 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
390}
391
392void DOMFrontendDispatcher::childNodeInserted(int parentNodeId, int previousNodeId, RefPtr<Inspector::Protocol::DOM::Node> node)
393{
394 Ref<JSON::Object> jsonMessage = JSON::Object::create();
395 jsonMessage->setString("method"_s, "DOM.childNodeInserted"_s);
396 Ref<JSON::Object> paramsObject = JSON::Object::create();
397 paramsObject->setInteger("parentNodeId"_s, parentNodeId);
398 paramsObject->setInteger("previousNodeId"_s, previousNodeId);
399 paramsObject->setObject("node"_s, node);
400 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
401
402 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
403}
404
405void DOMFrontendDispatcher::childNodeRemoved(int parentNodeId, int nodeId)
406{
407 Ref<JSON::Object> jsonMessage = JSON::Object::create();
408 jsonMessage->setString("method"_s, "DOM.childNodeRemoved"_s);
409 Ref<JSON::Object> paramsObject = JSON::Object::create();
410 paramsObject->setInteger("parentNodeId"_s, parentNodeId);
411 paramsObject->setInteger("nodeId"_s, nodeId);
412 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
413
414 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
415}
416
417void DOMFrontendDispatcher::shadowRootPushed(int hostId, RefPtr<Inspector::Protocol::DOM::Node> root)
418{
419 Ref<JSON::Object> jsonMessage = JSON::Object::create();
420 jsonMessage->setString("method"_s, "DOM.shadowRootPushed"_s);
421 Ref<JSON::Object> paramsObject = JSON::Object::create();
422 paramsObject->setInteger("hostId"_s, hostId);
423 paramsObject->setObject("root"_s, root);
424 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
425
426 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
427}
428
429void DOMFrontendDispatcher::shadowRootPopped(int hostId, int rootId)
430{
431 Ref<JSON::Object> jsonMessage = JSON::Object::create();
432 jsonMessage->setString("method"_s, "DOM.shadowRootPopped"_s);
433 Ref<JSON::Object> paramsObject = JSON::Object::create();
434 paramsObject->setInteger("hostId"_s, hostId);
435 paramsObject->setInteger("rootId"_s, rootId);
436 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
437
438 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
439}
440
441void DOMFrontendDispatcher::customElementStateChanged(int nodeId, Inspector::Protocol::DOM::CustomElementState customElementState)
442{
443 Ref<JSON::Object> jsonMessage = JSON::Object::create();
444 jsonMessage->setString("method"_s, "DOM.customElementStateChanged"_s);
445 Ref<JSON::Object> paramsObject = JSON::Object::create();
446 paramsObject->setInteger("nodeId"_s, nodeId);
447 paramsObject->setString("customElementState"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(customElementState));
448 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
449
450 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
451}
452
453void DOMFrontendDispatcher::pseudoElementAdded(int parentId, RefPtr<Inspector::Protocol::DOM::Node> pseudoElement)
454{
455 Ref<JSON::Object> jsonMessage = JSON::Object::create();
456 jsonMessage->setString("method"_s, "DOM.pseudoElementAdded"_s);
457 Ref<JSON::Object> paramsObject = JSON::Object::create();
458 paramsObject->setInteger("parentId"_s, parentId);
459 paramsObject->setObject("pseudoElement"_s, pseudoElement);
460 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
461
462 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
463}
464
465void DOMFrontendDispatcher::pseudoElementRemoved(int parentId, int pseudoElementId)
466{
467 Ref<JSON::Object> jsonMessage = JSON::Object::create();
468 jsonMessage->setString("method"_s, "DOM.pseudoElementRemoved"_s);
469 Ref<JSON::Object> paramsObject = JSON::Object::create();
470 paramsObject->setInteger("parentId"_s, parentId);
471 paramsObject->setInteger("pseudoElementId"_s, pseudoElementId);
472 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
473
474 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
475}
476
477void DOMFrontendDispatcher::didAddEventListener(int nodeId)
478{
479 Ref<JSON::Object> jsonMessage = JSON::Object::create();
480 jsonMessage->setString("method"_s, "DOM.didAddEventListener"_s);
481 Ref<JSON::Object> paramsObject = JSON::Object::create();
482 paramsObject->setInteger("nodeId"_s, nodeId);
483 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
484
485 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
486}
487
488void DOMFrontendDispatcher::willRemoveEventListener(int nodeId)
489{
490 Ref<JSON::Object> jsonMessage = JSON::Object::create();
491 jsonMessage->setString("method"_s, "DOM.willRemoveEventListener"_s);
492 Ref<JSON::Object> paramsObject = JSON::Object::create();
493 paramsObject->setInteger("nodeId"_s, nodeId);
494 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
495
496 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
497}
498
499void DOMFrontendDispatcher::didFireEvent(int nodeId, const String& eventName, double timestamp, RefPtr<JSON::Object> data)
500{
501 Ref<JSON::Object> jsonMessage = JSON::Object::create();
502 jsonMessage->setString("method"_s, "DOM.didFireEvent"_s);
503 Ref<JSON::Object> paramsObject = JSON::Object::create();
504 paramsObject->setInteger("nodeId"_s, nodeId);
505 paramsObject->setString("eventName"_s, eventName);
506 paramsObject->setDouble("timestamp"_s, timestamp);
507 if (data)
508 paramsObject->setObject("data"_s, data);
509 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
510
511 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
512}
513
514void DOMFrontendDispatcher::powerEfficientPlaybackStateChanged(int nodeId, double timestamp, bool isPowerEfficient)
515{
516 Ref<JSON::Object> jsonMessage = JSON::Object::create();
517 jsonMessage->setString("method"_s, "DOM.powerEfficientPlaybackStateChanged"_s);
518 Ref<JSON::Object> paramsObject = JSON::Object::create();
519 paramsObject->setInteger("nodeId"_s, nodeId);
520 paramsObject->setDouble("timestamp"_s, timestamp);
521 paramsObject->setBoolean("isPowerEfficient"_s, isPowerEfficient);
522 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
523
524 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
525}
526
527void DOMStorageFrontendDispatcher::domStorageItemsCleared(RefPtr<Inspector::Protocol::DOMStorage::StorageId> storageId)
528{
529 Ref<JSON::Object> jsonMessage = JSON::Object::create();
530 jsonMessage->setString("method"_s, "DOMStorage.domStorageItemsCleared"_s);
531 Ref<JSON::Object> paramsObject = JSON::Object::create();
532 paramsObject->setObject("storageId"_s, storageId);
533 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
534
535 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
536}
537
538void DOMStorageFrontendDispatcher::domStorageItemRemoved(RefPtr<Inspector::Protocol::DOMStorage::StorageId> storageId, const String& key)
539{
540 Ref<JSON::Object> jsonMessage = JSON::Object::create();
541 jsonMessage->setString("method"_s, "DOMStorage.domStorageItemRemoved"_s);
542 Ref<JSON::Object> paramsObject = JSON::Object::create();
543 paramsObject->setObject("storageId"_s, storageId);
544 paramsObject->setString("key"_s, key);
545 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
546
547 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
548}
549
550void DOMStorageFrontendDispatcher::domStorageItemAdded(RefPtr<Inspector::Protocol::DOMStorage::StorageId> storageId, const String& key, const String& newValue)
551{
552 Ref<JSON::Object> jsonMessage = JSON::Object::create();
553 jsonMessage->setString("method"_s, "DOMStorage.domStorageItemAdded"_s);
554 Ref<JSON::Object> paramsObject = JSON::Object::create();
555 paramsObject->setObject("storageId"_s, storageId);
556 paramsObject->setString("key"_s, key);
557 paramsObject->setString("newValue"_s, newValue);
558 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
559
560 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
561}
562
563void DOMStorageFrontendDispatcher::domStorageItemUpdated(RefPtr<Inspector::Protocol::DOMStorage::StorageId> storageId, const String& key, const String& oldValue, const String& newValue)
564{
565 Ref<JSON::Object> jsonMessage = JSON::Object::create();
566 jsonMessage->setString("method"_s, "DOMStorage.domStorageItemUpdated"_s);
567 Ref<JSON::Object> paramsObject = JSON::Object::create();
568 paramsObject->setObject("storageId"_s, storageId);
569 paramsObject->setString("key"_s, key);
570 paramsObject->setString("oldValue"_s, oldValue);
571 paramsObject->setString("newValue"_s, newValue);
572 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
573
574 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
575}
576
577void DatabaseFrontendDispatcher::addDatabase(RefPtr<Inspector::Protocol::Database::Database> database)
578{
579 Ref<JSON::Object> jsonMessage = JSON::Object::create();
580 jsonMessage->setString("method"_s, "Database.addDatabase"_s);
581 Ref<JSON::Object> paramsObject = JSON::Object::create();
582 paramsObject->setObject("database"_s, database);
583 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
584
585 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
586}
587
588void DebuggerFrontendDispatcher::globalObjectCleared()
589{
590 Ref<JSON::Object> jsonMessage = JSON::Object::create();
591 jsonMessage->setString("method"_s, "Debugger.globalObjectCleared"_s);
592
593 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
594}
595
596void DebuggerFrontendDispatcher::scriptParsed(const String& scriptId, const String& url, int startLine, int startColumn, int endLine, int endColumn, const bool* isContentScript, const String* sourceURL, const String* sourceMapURL, const bool* module)
597{
598 Ref<JSON::Object> jsonMessage = JSON::Object::create();
599 jsonMessage->setString("method"_s, "Debugger.scriptParsed"_s);
600 Ref<JSON::Object> paramsObject = JSON::Object::create();
601 paramsObject->setString("scriptId"_s, scriptId);
602 paramsObject->setString("url"_s, url);
603 paramsObject->setInteger("startLine"_s, startLine);
604 paramsObject->setInteger("startColumn"_s, startColumn);
605 paramsObject->setInteger("endLine"_s, endLine);
606 paramsObject->setInteger("endColumn"_s, endColumn);
607 if (isContentScript)
608 paramsObject->setBoolean("isContentScript"_s, *isContentScript);
609 if (sourceURL)
610 paramsObject->setString("sourceURL"_s, *sourceURL);
611 if (sourceMapURL)
612 paramsObject->setString("sourceMapURL"_s, *sourceMapURL);
613 if (module)
614 paramsObject->setBoolean("module"_s, *module);
615 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
616
617 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
618}
619
620void DebuggerFrontendDispatcher::scriptFailedToParse(const String& url, const String& scriptSource, int startLine, int errorLine, const String& errorMessage)
621{
622 Ref<JSON::Object> jsonMessage = JSON::Object::create();
623 jsonMessage->setString("method"_s, "Debugger.scriptFailedToParse"_s);
624 Ref<JSON::Object> paramsObject = JSON::Object::create();
625 paramsObject->setString("url"_s, url);
626 paramsObject->setString("scriptSource"_s, scriptSource);
627 paramsObject->setInteger("startLine"_s, startLine);
628 paramsObject->setInteger("errorLine"_s, errorLine);
629 paramsObject->setString("errorMessage"_s, errorMessage);
630 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
631
632 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
633}
634
635void DebuggerFrontendDispatcher::breakpointResolved(const String& breakpointId, RefPtr<Inspector::Protocol::Debugger::Location> location)
636{
637 Ref<JSON::Object> jsonMessage = JSON::Object::create();
638 jsonMessage->setString("method"_s, "Debugger.breakpointResolved"_s);
639 Ref<JSON::Object> paramsObject = JSON::Object::create();
640 paramsObject->setString("breakpointId"_s, breakpointId);
641 paramsObject->setObject("location"_s, location);
642 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
643
644 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
645}
646
647void DebuggerFrontendDispatcher::paused(RefPtr<JSON::ArrayOf<Inspector::Protocol::Debugger::CallFrame>> callFrames, Reason reason, RefPtr<JSON::Object> data, RefPtr<Inspector::Protocol::Console::StackTrace> asyncStackTrace)
648{
649 Ref<JSON::Object> jsonMessage = JSON::Object::create();
650 jsonMessage->setString("method"_s, "Debugger.paused"_s);
651 Ref<JSON::Object> paramsObject = JSON::Object::create();
652 paramsObject->setArray("callFrames"_s, callFrames);
653 paramsObject->setString("reason"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(reason));
654 if (data)
655 paramsObject->setObject("data"_s, data);
656 if (asyncStackTrace)
657 paramsObject->setObject("asyncStackTrace"_s, asyncStackTrace);
658 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
659
660 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
661}
662
663void DebuggerFrontendDispatcher::resumed()
664{
665 Ref<JSON::Object> jsonMessage = JSON::Object::create();
666 jsonMessage->setString("method"_s, "Debugger.resumed"_s);
667
668 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
669}
670
671void DebuggerFrontendDispatcher::didSampleProbe(RefPtr<Inspector::Protocol::Debugger::ProbeSample> sample)
672{
673 Ref<JSON::Object> jsonMessage = JSON::Object::create();
674 jsonMessage->setString("method"_s, "Debugger.didSampleProbe"_s);
675 Ref<JSON::Object> paramsObject = JSON::Object::create();
676 paramsObject->setObject("sample"_s, sample);
677 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
678
679 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
680}
681
682void DebuggerFrontendDispatcher::playBreakpointActionSound(int breakpointActionId)
683{
684 Ref<JSON::Object> jsonMessage = JSON::Object::create();
685 jsonMessage->setString("method"_s, "Debugger.playBreakpointActionSound"_s);
686 Ref<JSON::Object> paramsObject = JSON::Object::create();
687 paramsObject->setInteger("breakpointActionId"_s, breakpointActionId);
688 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
689
690 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
691}
692
693void HeapFrontendDispatcher::garbageCollected(RefPtr<Inspector::Protocol::Heap::GarbageCollection> collection)
694{
695 Ref<JSON::Object> jsonMessage = JSON::Object::create();
696 jsonMessage->setString("method"_s, "Heap.garbageCollected"_s);
697 Ref<JSON::Object> paramsObject = JSON::Object::create();
698 paramsObject->setObject("collection"_s, collection);
699 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
700
701 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
702}
703
704void HeapFrontendDispatcher::trackingStart(double timestamp, const String& snapshotData)
705{
706 Ref<JSON::Object> jsonMessage = JSON::Object::create();
707 jsonMessage->setString("method"_s, "Heap.trackingStart"_s);
708 Ref<JSON::Object> paramsObject = JSON::Object::create();
709 paramsObject->setDouble("timestamp"_s, timestamp);
710 paramsObject->setString("snapshotData"_s, snapshotData);
711 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
712
713 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
714}
715
716void HeapFrontendDispatcher::trackingComplete(double timestamp, const String& snapshotData)
717{
718 Ref<JSON::Object> jsonMessage = JSON::Object::create();
719 jsonMessage->setString("method"_s, "Heap.trackingComplete"_s);
720 Ref<JSON::Object> paramsObject = JSON::Object::create();
721 paramsObject->setDouble("timestamp"_s, timestamp);
722 paramsObject->setString("snapshotData"_s, snapshotData);
723 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
724
725 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
726}
727
728void InspectorFrontendDispatcher::evaluateForTestInFrontend(const String& script)
729{
730 Ref<JSON::Object> jsonMessage = JSON::Object::create();
731 jsonMessage->setString("method"_s, "Inspector.evaluateForTestInFrontend"_s);
732 Ref<JSON::Object> paramsObject = JSON::Object::create();
733 paramsObject->setString("script"_s, script);
734 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
735
736 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
737}
738
739void InspectorFrontendDispatcher::inspect(RefPtr<Inspector::Protocol::Runtime::RemoteObject> object, RefPtr<JSON::Object> hints)
740{
741 Ref<JSON::Object> jsonMessage = JSON::Object::create();
742 jsonMessage->setString("method"_s, "Inspector.inspect"_s);
743 Ref<JSON::Object> paramsObject = JSON::Object::create();
744 paramsObject->setObject("object"_s, object);
745 paramsObject->setObject("hints"_s, hints);
746 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
747
748 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
749}
750
751void InspectorFrontendDispatcher::activateExtraDomains(RefPtr<JSON::ArrayOf<String>> domains)
752{
753 Ref<JSON::Object> jsonMessage = JSON::Object::create();
754 jsonMessage->setString("method"_s, "Inspector.activateExtraDomains"_s);
755 Ref<JSON::Object> paramsObject = JSON::Object::create();
756 paramsObject->setArray("domains"_s, domains);
757 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
758
759 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
760}
761
762void LayerTreeFrontendDispatcher::layerTreeDidChange()
763{
764 Ref<JSON::Object> jsonMessage = JSON::Object::create();
765 jsonMessage->setString("method"_s, "LayerTree.layerTreeDidChange"_s);
766
767 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
768}
769
770#if ENABLE(RESOURCE_USAGE)
771void MemoryFrontendDispatcher::memoryPressure(double timestamp, Severity severity)
772{
773 Ref<JSON::Object> jsonMessage = JSON::Object::create();
774 jsonMessage->setString("method"_s, "Memory.memoryPressure"_s);
775 Ref<JSON::Object> paramsObject = JSON::Object::create();
776 paramsObject->setDouble("timestamp"_s, timestamp);
777 paramsObject->setString("severity"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(severity));
778 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
779
780 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
781}
782
783void MemoryFrontendDispatcher::trackingStart(double timestamp)
784{
785 Ref<JSON::Object> jsonMessage = JSON::Object::create();
786 jsonMessage->setString("method"_s, "Memory.trackingStart"_s);
787 Ref<JSON::Object> paramsObject = JSON::Object::create();
788 paramsObject->setDouble("timestamp"_s, timestamp);
789 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
790
791 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
792}
793
794void MemoryFrontendDispatcher::trackingUpdate(RefPtr<Inspector::Protocol::Memory::Event> event)
795{
796 Ref<JSON::Object> jsonMessage = JSON::Object::create();
797 jsonMessage->setString("method"_s, "Memory.trackingUpdate"_s);
798 Ref<JSON::Object> paramsObject = JSON::Object::create();
799 paramsObject->setObject("event"_s, event);
800 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
801
802 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
803}
804
805void MemoryFrontendDispatcher::trackingComplete(double timestamp)
806{
807 Ref<JSON::Object> jsonMessage = JSON::Object::create();
808 jsonMessage->setString("method"_s, "Memory.trackingComplete"_s);
809 Ref<JSON::Object> paramsObject = JSON::Object::create();
810 paramsObject->setDouble("timestamp"_s, timestamp);
811 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
812
813 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
814}
815#endif // ENABLE(RESOURCE_USAGE)
816
817void NetworkFrontendDispatcher::requestWillBeSent(const String& requestId, const String& frameId, const String& loaderId, const String& documentURL, RefPtr<Inspector::Protocol::Network::Request> request, double timestamp, double walltime, RefPtr<Inspector::Protocol::Network::Initiator> initiator, RefPtr<Inspector::Protocol::Network::Response> redirectResponse, Inspector::Protocol::Page::ResourceType* type, const String* targetId)
818{
819 Ref<JSON::Object> jsonMessage = JSON::Object::create();
820 jsonMessage->setString("method"_s, "Network.requestWillBeSent"_s);
821 Ref<JSON::Object> paramsObject = JSON::Object::create();
822 paramsObject->setString("requestId"_s, requestId);
823 paramsObject->setString("frameId"_s, frameId);
824 paramsObject->setString("loaderId"_s, loaderId);
825 paramsObject->setString("documentURL"_s, documentURL);
826 paramsObject->setObject("request"_s, request);
827 paramsObject->setDouble("timestamp"_s, timestamp);
828 paramsObject->setDouble("walltime"_s, walltime);
829 paramsObject->setObject("initiator"_s, initiator);
830 if (redirectResponse)
831 paramsObject->setObject("redirectResponse"_s, redirectResponse);
832 if (type)
833 paramsObject->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(*type));
834 if (targetId)
835 paramsObject->setString("targetId"_s, *targetId);
836 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
837
838 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
839}
840
841void NetworkFrontendDispatcher::responseReceived(const String& requestId, const String& frameId, const String& loaderId, double timestamp, Inspector::Protocol::Page::ResourceType type, RefPtr<Inspector::Protocol::Network::Response> response)
842{
843 Ref<JSON::Object> jsonMessage = JSON::Object::create();
844 jsonMessage->setString("method"_s, "Network.responseReceived"_s);
845 Ref<JSON::Object> paramsObject = JSON::Object::create();
846 paramsObject->setString("requestId"_s, requestId);
847 paramsObject->setString("frameId"_s, frameId);
848 paramsObject->setString("loaderId"_s, loaderId);
849 paramsObject->setDouble("timestamp"_s, timestamp);
850 paramsObject->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(type));
851 paramsObject->setObject("response"_s, response);
852 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
853
854 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
855}
856
857void NetworkFrontendDispatcher::dataReceived(const String& requestId, double timestamp, int dataLength, int encodedDataLength)
858{
859 Ref<JSON::Object> jsonMessage = JSON::Object::create();
860 jsonMessage->setString("method"_s, "Network.dataReceived"_s);
861 Ref<JSON::Object> paramsObject = JSON::Object::create();
862 paramsObject->setString("requestId"_s, requestId);
863 paramsObject->setDouble("timestamp"_s, timestamp);
864 paramsObject->setInteger("dataLength"_s, dataLength);
865 paramsObject->setInteger("encodedDataLength"_s, encodedDataLength);
866 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
867
868 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
869}
870
871void NetworkFrontendDispatcher::loadingFinished(const String& requestId, double timestamp, const String* sourceMapURL, RefPtr<Inspector::Protocol::Network::Metrics> metrics)
872{
873 Ref<JSON::Object> jsonMessage = JSON::Object::create();
874 jsonMessage->setString("method"_s, "Network.loadingFinished"_s);
875 Ref<JSON::Object> paramsObject = JSON::Object::create();
876 paramsObject->setString("requestId"_s, requestId);
877 paramsObject->setDouble("timestamp"_s, timestamp);
878 if (sourceMapURL)
879 paramsObject->setString("sourceMapURL"_s, *sourceMapURL);
880 if (metrics)
881 paramsObject->setObject("metrics"_s, metrics);
882 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
883
884 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
885}
886
887void NetworkFrontendDispatcher::loadingFailed(const String& requestId, double timestamp, const String& errorText, const bool* canceled)
888{
889 Ref<JSON::Object> jsonMessage = JSON::Object::create();
890 jsonMessage->setString("method"_s, "Network.loadingFailed"_s);
891 Ref<JSON::Object> paramsObject = JSON::Object::create();
892 paramsObject->setString("requestId"_s, requestId);
893 paramsObject->setDouble("timestamp"_s, timestamp);
894 paramsObject->setString("errorText"_s, errorText);
895 if (canceled)
896 paramsObject->setBoolean("canceled"_s, *canceled);
897 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
898
899 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
900}
901
902void NetworkFrontendDispatcher::requestServedFromMemoryCache(const String& requestId, const String& frameId, const String& loaderId, const String& documentURL, double timestamp, RefPtr<Inspector::Protocol::Network::Initiator> initiator, RefPtr<Inspector::Protocol::Network::CachedResource> resource)
903{
904 Ref<JSON::Object> jsonMessage = JSON::Object::create();
905 jsonMessage->setString("method"_s, "Network.requestServedFromMemoryCache"_s);
906 Ref<JSON::Object> paramsObject = JSON::Object::create();
907 paramsObject->setString("requestId"_s, requestId);
908 paramsObject->setString("frameId"_s, frameId);
909 paramsObject->setString("loaderId"_s, loaderId);
910 paramsObject->setString("documentURL"_s, documentURL);
911 paramsObject->setDouble("timestamp"_s, timestamp);
912 paramsObject->setObject("initiator"_s, initiator);
913 paramsObject->setObject("resource"_s, resource);
914 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
915
916 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
917}
918
919void NetworkFrontendDispatcher::webSocketWillSendHandshakeRequest(const String& requestId, double timestamp, double walltime, RefPtr<Inspector::Protocol::Network::WebSocketRequest> request)
920{
921 Ref<JSON::Object> jsonMessage = JSON::Object::create();
922 jsonMessage->setString("method"_s, "Network.webSocketWillSendHandshakeRequest"_s);
923 Ref<JSON::Object> paramsObject = JSON::Object::create();
924 paramsObject->setString("requestId"_s, requestId);
925 paramsObject->setDouble("timestamp"_s, timestamp);
926 paramsObject->setDouble("walltime"_s, walltime);
927 paramsObject->setObject("request"_s, request);
928 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
929
930 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
931}
932
933void NetworkFrontendDispatcher::webSocketHandshakeResponseReceived(const String& requestId, double timestamp, RefPtr<Inspector::Protocol::Network::WebSocketResponse> response)
934{
935 Ref<JSON::Object> jsonMessage = JSON::Object::create();
936 jsonMessage->setString("method"_s, "Network.webSocketHandshakeResponseReceived"_s);
937 Ref<JSON::Object> paramsObject = JSON::Object::create();
938 paramsObject->setString("requestId"_s, requestId);
939 paramsObject->setDouble("timestamp"_s, timestamp);
940 paramsObject->setObject("response"_s, response);
941 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
942
943 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
944}
945
946void NetworkFrontendDispatcher::webSocketCreated(const String& requestId, const String& url)
947{
948 Ref<JSON::Object> jsonMessage = JSON::Object::create();
949 jsonMessage->setString("method"_s, "Network.webSocketCreated"_s);
950 Ref<JSON::Object> paramsObject = JSON::Object::create();
951 paramsObject->setString("requestId"_s, requestId);
952 paramsObject->setString("url"_s, url);
953 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
954
955 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
956}
957
958void NetworkFrontendDispatcher::webSocketClosed(const String& requestId, double timestamp)
959{
960 Ref<JSON::Object> jsonMessage = JSON::Object::create();
961 jsonMessage->setString("method"_s, "Network.webSocketClosed"_s);
962 Ref<JSON::Object> paramsObject = JSON::Object::create();
963 paramsObject->setString("requestId"_s, requestId);
964 paramsObject->setDouble("timestamp"_s, timestamp);
965 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
966
967 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
968}
969
970void NetworkFrontendDispatcher::webSocketFrameReceived(const String& requestId, double timestamp, RefPtr<Inspector::Protocol::Network::WebSocketFrame> response)
971{
972 Ref<JSON::Object> jsonMessage = JSON::Object::create();
973 jsonMessage->setString("method"_s, "Network.webSocketFrameReceived"_s);
974 Ref<JSON::Object> paramsObject = JSON::Object::create();
975 paramsObject->setString("requestId"_s, requestId);
976 paramsObject->setDouble("timestamp"_s, timestamp);
977 paramsObject->setObject("response"_s, response);
978 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
979
980 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
981}
982
983void NetworkFrontendDispatcher::webSocketFrameError(const String& requestId, double timestamp, const String& errorMessage)
984{
985 Ref<JSON::Object> jsonMessage = JSON::Object::create();
986 jsonMessage->setString("method"_s, "Network.webSocketFrameError"_s);
987 Ref<JSON::Object> paramsObject = JSON::Object::create();
988 paramsObject->setString("requestId"_s, requestId);
989 paramsObject->setDouble("timestamp"_s, timestamp);
990 paramsObject->setString("errorMessage"_s, errorMessage);
991 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
992
993 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
994}
995
996void NetworkFrontendDispatcher::webSocketFrameSent(const String& requestId, double timestamp, RefPtr<Inspector::Protocol::Network::WebSocketFrame> response)
997{
998 Ref<JSON::Object> jsonMessage = JSON::Object::create();
999 jsonMessage->setString("method"_s, "Network.webSocketFrameSent"_s);
1000 Ref<JSON::Object> paramsObject = JSON::Object::create();
1001 paramsObject->setString("requestId"_s, requestId);
1002 paramsObject->setDouble("timestamp"_s, timestamp);
1003 paramsObject->setObject("response"_s, response);
1004 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1005
1006 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1007}
1008
1009void PageFrontendDispatcher::domContentEventFired(double timestamp)
1010{
1011 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1012 jsonMessage->setString("method"_s, "Page.domContentEventFired"_s);
1013 Ref<JSON::Object> paramsObject = JSON::Object::create();
1014 paramsObject->setDouble("timestamp"_s, timestamp);
1015 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1016
1017 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1018}
1019
1020void PageFrontendDispatcher::loadEventFired(double timestamp)
1021{
1022 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1023 jsonMessage->setString("method"_s, "Page.loadEventFired"_s);
1024 Ref<JSON::Object> paramsObject = JSON::Object::create();
1025 paramsObject->setDouble("timestamp"_s, timestamp);
1026 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1027
1028 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1029}
1030
1031void PageFrontendDispatcher::frameNavigated(RefPtr<Inspector::Protocol::Page::Frame> frame)
1032{
1033 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1034 jsonMessage->setString("method"_s, "Page.frameNavigated"_s);
1035 Ref<JSON::Object> paramsObject = JSON::Object::create();
1036 paramsObject->setObject("frame"_s, frame);
1037 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1038
1039 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1040}
1041
1042void PageFrontendDispatcher::frameDetached(const String& frameId)
1043{
1044 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1045 jsonMessage->setString("method"_s, "Page.frameDetached"_s);
1046 Ref<JSON::Object> paramsObject = JSON::Object::create();
1047 paramsObject->setString("frameId"_s, frameId);
1048 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1049
1050 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1051}
1052
1053void PageFrontendDispatcher::frameStartedLoading(const String& frameId)
1054{
1055 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1056 jsonMessage->setString("method"_s, "Page.frameStartedLoading"_s);
1057 Ref<JSON::Object> paramsObject = JSON::Object::create();
1058 paramsObject->setString("frameId"_s, frameId);
1059 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1060
1061 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1062}
1063
1064void PageFrontendDispatcher::frameStoppedLoading(const String& frameId)
1065{
1066 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1067 jsonMessage->setString("method"_s, "Page.frameStoppedLoading"_s);
1068 Ref<JSON::Object> paramsObject = JSON::Object::create();
1069 paramsObject->setString("frameId"_s, frameId);
1070 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1071
1072 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1073}
1074
1075void PageFrontendDispatcher::frameScheduledNavigation(const String& frameId, double delay)
1076{
1077 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1078 jsonMessage->setString("method"_s, "Page.frameScheduledNavigation"_s);
1079 Ref<JSON::Object> paramsObject = JSON::Object::create();
1080 paramsObject->setString("frameId"_s, frameId);
1081 paramsObject->setDouble("delay"_s, delay);
1082 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1083
1084 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1085}
1086
1087void PageFrontendDispatcher::frameClearedScheduledNavigation(const String& frameId)
1088{
1089 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1090 jsonMessage->setString("method"_s, "Page.frameClearedScheduledNavigation"_s);
1091 Ref<JSON::Object> paramsObject = JSON::Object::create();
1092 paramsObject->setString("frameId"_s, frameId);
1093 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1094
1095 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1096}
1097
1098void PageFrontendDispatcher::defaultAppearanceDidChange(Inspector::Protocol::Page::Appearance appearance)
1099{
1100 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1101 jsonMessage->setString("method"_s, "Page.defaultAppearanceDidChange"_s);
1102 Ref<JSON::Object> paramsObject = JSON::Object::create();
1103 paramsObject->setString("appearance"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(appearance));
1104 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1105
1106 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1107}
1108
1109void RuntimeFrontendDispatcher::executionContextCreated(RefPtr<Inspector::Protocol::Runtime::ExecutionContextDescription> context)
1110{
1111 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1112 jsonMessage->setString("method"_s, "Runtime.executionContextCreated"_s);
1113 Ref<JSON::Object> paramsObject = JSON::Object::create();
1114 paramsObject->setObject("context"_s, context);
1115 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1116
1117 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1118}
1119
1120void ScriptProfilerFrontendDispatcher::trackingStart(double timestamp)
1121{
1122 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1123 jsonMessage->setString("method"_s, "ScriptProfiler.trackingStart"_s);
1124 Ref<JSON::Object> paramsObject = JSON::Object::create();
1125 paramsObject->setDouble("timestamp"_s, timestamp);
1126 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1127
1128 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1129}
1130
1131void ScriptProfilerFrontendDispatcher::trackingUpdate(RefPtr<Inspector::Protocol::ScriptProfiler::Event> event)
1132{
1133 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1134 jsonMessage->setString("method"_s, "ScriptProfiler.trackingUpdate"_s);
1135 Ref<JSON::Object> paramsObject = JSON::Object::create();
1136 paramsObject->setObject("event"_s, event);
1137 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1138
1139 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1140}
1141
1142void ScriptProfilerFrontendDispatcher::trackingComplete(double timestamp, RefPtr<Inspector::Protocol::ScriptProfiler::Samples> samples)
1143{
1144 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1145 jsonMessage->setString("method"_s, "ScriptProfiler.trackingComplete"_s);
1146 Ref<JSON::Object> paramsObject = JSON::Object::create();
1147 paramsObject->setDouble("timestamp"_s, timestamp);
1148 if (samples)
1149 paramsObject->setObject("samples"_s, samples);
1150 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1151
1152 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1153}
1154
1155void TargetFrontendDispatcher::targetCreated(RefPtr<Inspector::Protocol::Target::TargetInfo> targetInfo)
1156{
1157 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1158 jsonMessage->setString("method"_s, "Target.targetCreated"_s);
1159 Ref<JSON::Object> paramsObject = JSON::Object::create();
1160 paramsObject->setObject("targetInfo"_s, targetInfo);
1161 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1162
1163 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1164}
1165
1166void TargetFrontendDispatcher::targetDestroyed(const String& targetId)
1167{
1168 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1169 jsonMessage->setString("method"_s, "Target.targetDestroyed"_s);
1170 Ref<JSON::Object> paramsObject = JSON::Object::create();
1171 paramsObject->setString("targetId"_s, targetId);
1172 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1173
1174 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1175}
1176
1177void TargetFrontendDispatcher::dispatchMessageFromTarget(const String& targetId, const String& message)
1178{
1179 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1180 jsonMessage->setString("method"_s, "Target.dispatchMessageFromTarget"_s);
1181 Ref<JSON::Object> paramsObject = JSON::Object::create();
1182 paramsObject->setString("targetId"_s, targetId);
1183 paramsObject->setString("message"_s, message);
1184 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1185
1186 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1187}
1188
1189void TimelineFrontendDispatcher::eventRecorded(RefPtr<Inspector::Protocol::Timeline::TimelineEvent> record)
1190{
1191 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1192 jsonMessage->setString("method"_s, "Timeline.eventRecorded"_s);
1193 Ref<JSON::Object> paramsObject = JSON::Object::create();
1194 paramsObject->setObject("record"_s, record);
1195 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1196
1197 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1198}
1199
1200void TimelineFrontendDispatcher::recordingStarted(double startTime)
1201{
1202 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1203 jsonMessage->setString("method"_s, "Timeline.recordingStarted"_s);
1204 Ref<JSON::Object> paramsObject = JSON::Object::create();
1205 paramsObject->setDouble("startTime"_s, startTime);
1206 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1207
1208 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1209}
1210
1211void TimelineFrontendDispatcher::recordingStopped(double endTime)
1212{
1213 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1214 jsonMessage->setString("method"_s, "Timeline.recordingStopped"_s);
1215 Ref<JSON::Object> paramsObject = JSON::Object::create();
1216 paramsObject->setDouble("endTime"_s, endTime);
1217 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1218
1219 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1220}
1221
1222void TimelineFrontendDispatcher::autoCaptureStarted()
1223{
1224 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1225 jsonMessage->setString("method"_s, "Timeline.autoCaptureStarted"_s);
1226
1227 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1228}
1229
1230void WorkerFrontendDispatcher::workerCreated(const String& workerId, const String& url)
1231{
1232 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1233 jsonMessage->setString("method"_s, "Worker.workerCreated"_s);
1234 Ref<JSON::Object> paramsObject = JSON::Object::create();
1235 paramsObject->setString("workerId"_s, workerId);
1236 paramsObject->setString("url"_s, url);
1237 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1238
1239 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1240}
1241
1242void WorkerFrontendDispatcher::workerTerminated(const String& workerId)
1243{
1244 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1245 jsonMessage->setString("method"_s, "Worker.workerTerminated"_s);
1246 Ref<JSON::Object> paramsObject = JSON::Object::create();
1247 paramsObject->setString("workerId"_s, workerId);
1248 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1249
1250 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1251}
1252
1253void WorkerFrontendDispatcher::dispatchMessageFromWorker(const String& workerId, const String& message)
1254{
1255 Ref<JSON::Object> jsonMessage = JSON::Object::create();
1256 jsonMessage->setString("method"_s, "Worker.dispatchMessageFromWorker"_s);
1257 Ref<JSON::Object> paramsObject = JSON::Object::create();
1258 paramsObject->setString("workerId"_s, workerId);
1259 paramsObject->setString("message"_s, message);
1260 jsonMessage->setObject("params"_s, WTFMove(paramsObject));
1261
1262 m_frontendRouter.sendEvent(jsonMessage->toJSONString());
1263}
1264
1265} // namespace Inspector
1266