1/*
2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 *     * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *     * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 *     * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/*
32 * make_instrumenting_probes.py uses this file as a source to generate
33 * core_probes_inl.h, core_probes_impl.cc and core_probe_sink.h.
34 *
35 * The code below is not a correct IDL but a mix of IDL and C++.
36 *
37 * The syntax for an instrumentation method is as follows:
38 *
39 *    returnValue methodName([paramAttr1] param1, [paramAttr2] param2, ...)
40 *
41 * Where:
42 *   paramAttr - optional attribute controlling the parameters handling (one attribute per parameter max).
43 *       Keep - pass first parameter (used to access the CoreProbeSink instance) to agents.
44 *
45 *   returnValue: "void" for instant probes.
46 *                Omitted for the scoped probes.
47 *
48 *   methodName: C++ name for the public instrumentation method and agents methods.
49 *
50 *   paramList: C++ parameter list with optional names. Names will be deduced from types if omitted but you have to
51 *        specify explicit names for multiple parameters of the same type.
52 */
53
54interface CoreProbes {
55
56  class InspectorIssue;
57  class ConsoleMessage;
58  class FontCustomPlatformData;
59  class FontFace;
60  class HTMLDocumentParser;
61  class XMLHttpRequest;
62  class HTMLInputElement;
63  class HTMLPortalElement;
64
65  void DidClearDocumentOfWindowObject([Keep] LocalFrame*);
66  void WillInsertDOMNode([Keep] Node* parent);
67  void DidInsertDOMNode([Keep] Node*);
68  void WillRemoveDOMNode([Keep] Node*);
69  void WillModifyDOMAttr([Keep] Element*, const AtomicString& old_value, const AtomicString& new_value);
70  void DidModifyDOMAttr([Keep] Element*, const QualifiedName& name, const AtomicString& value);
71  void DidRemoveDOMAttr([Keep] Element*, const QualifiedName& name);
72  void WillChangeStyleElement([Keep] Element*);
73  void CharacterDataModified([Keep] CharacterData*);
74  void DidInvalidateStyleAttr([Keep] Node*);
75  void DidPerformElementShadowDistribution([Keep] Element*);
76  void DidPerformSlotDistribution([Keep] HTMLSlotElement*);
77  void DocumentDetached([Keep] Document*);
78  void ActiveStyleSheetsUpdated([Keep] Document*);
79  void FontsUpdated(ExecutionContext*, const FontFace* face, const String& src, const FontCustomPlatformData* font_custom_platform_data);
80  void MediaQueryResultChanged(Document*);
81  void DidPushShadowRoot([Keep] Element* host, ShadowRoot*);
82  void WillPopShadowRoot([Keep] Element* host, ShadowRoot*);
83  void WillSendXMLHttpOrFetchNetworkRequest(ExecutionContext*, const String& url);
84  void DidCreateCanvasContext(Document*);
85  void DidFireWebGLError(Element*, const String& error_name);
86  void DidFireWebGLWarning(Element*);
87  void DidFireWebGLErrorOrWarning(Element*, const String& message);
88  void DidResizeMainFrame(LocalFrame*);
89  void ApplyAcceptLanguageOverride(ExecutionContext*, String* accept_language);
90  void ApplyUserAgentOverride(CoreProbeSink*, String* user_agent);
91  void DidBlockRequest(CoreProbeSink*, const ResourceRequest&, DocumentLoader*, const KURL& fetch_context_url, const FetchInitiatorInfo&, ResourceRequestBlockedReason, ResourceType);
92  void DidChangeResourcePriority(LocalFrame*, DocumentLoader*, uint64_t identifier, ResourceLoadPriority load_priority);
93  void PrepareRequest(CoreProbeSink*, DocumentLoader*, ResourceRequest&, const FetchInitiatorInfo&, ResourceType);
94  void WillSendRequest(CoreProbeSink*, uint64_t identifier, DocumentLoader*, const KURL& fetch_context_url, const ResourceRequest&, const ResourceResponse& redirect_response, const FetchInitiatorInfo&, ResourceType);
95  void WillSendNavigationRequest(CoreProbeSink*, uint64_t identifier, DocumentLoader*, const KURL&, const AtomicString& http_method, EncodedFormData*);
96  void MarkResourceAsCached(LocalFrame*, DocumentLoader*, uint64_t identifier);
97  void DidReceiveResourceResponse(CoreProbeSink*, uint64_t identifier, DocumentLoader*, const ResourceResponse&, const Resource*);
98  void DidReceiveData(CoreProbeSink*, uint64_t identifier, DocumentLoader*, const char* data, uint64_t data_length);
99  void DidReceiveBlob(CoreProbeSink*, uint64_t identifier, DocumentLoader*, BlobDataHandle*);
100  void DidReceiveEncodedDataLength(CoreProbeSink*, DocumentLoader* loader, uint64_t identifier, size_t encoded_data_length);
101  void DidFinishLoading(CoreProbeSink*, uint64_t identifier, DocumentLoader*, base::TimeTicks finish_time, int64_t encoded_data_length, int64_t decoded_body_length, bool should_report_corb_blocking);
102  void DidReceiveCorsRedirectResponse(ExecutionContext*, uint64_t identifier, DocumentLoader*, const ResourceResponse&, Resource*);
103  void DidFailLoading(CoreProbeSink*, uint64_t identifier, DocumentLoader*, const ResourceError&);
104  void WillSendEventSourceRequest(ExecutionContext*);
105  void WillDispatchEventSourceEvent(ExecutionContext*, uint64_t identifier, const AtomicString& event_name, const AtomicString& event_id, const String& data);
106  void WillLoadXHR([Keep] ExecutionContext*, const AtomicString& method, const KURL& url, bool async, const HTTPHeaderMap& headers, bool include_credentials);
107  void DidFinishXHR(ExecutionContext*, XMLHttpRequest* xhr);
108  void ScriptImported(ExecutionContext*, uint64_t identifier, const String& source_string);
109  void ScriptExecutionBlockedByCSP(ExecutionContext*, const String& directive_text);
110  void DidReceiveScriptResponse(ExecutionContext*, uint64_t identifier);
111  void DomContentLoadedEventFired([Keep] LocalFrame*);
112  void LoadEventFired([Keep] LocalFrame*);
113  void FrameAttachedToParent([Keep] LocalFrame*);
114  void FrameDetachedFromParent([Keep] LocalFrame*);
115  void DidStartProvisionalLoad([Keep] LocalFrame*);
116  void DidFailProvisionalLoad([Keep] LocalFrame*);
117  void WillCommitLoad([Keep] LocalFrame*, DocumentLoader*);
118  void DidCommitLoad([Keep] LocalFrame*, DocumentLoader*);
119  void DidNavigateWithinDocument([Keep] LocalFrame*);
120  void FrameDocumentUpdated([Keep] LocalFrame*);
121  void FrameOwnerContentUpdated([Keep] LocalFrame*, HTMLFrameOwnerElement*);
122  void FrameStartedLoading([Keep] LocalFrame*);
123  void FrameStoppedLoading([Keep] LocalFrame*);
124  void FrameRequestedNavigation(LocalFrame*, Frame* target_frame, const KURL& url, ClientNavigationReason reason);
125  void FrameScheduledNavigation([Keep] LocalFrame*, const KURL& url, base::TimeDelta delay, ClientNavigationReason reason);
126  void FrameClearedScheduledNavigation([Keep] LocalFrame*);
127  void DidCreateWebSocket([Keep] ExecutionContext*, uint64_t identifier, const KURL& request_url, const String& protocol);
128  void WillSendWebSocketHandshakeRequest([Keep] ExecutionContext*, uint64_t identifier, network::mojom::blink::WebSocketHandshakeRequest* request);
129  void DidReceiveWebSocketHandshakeResponse([Keep] ExecutionContext*, uint64_t identifier, network::mojom::blink::WebSocketHandshakeRequest* request, network::mojom::blink::WebSocketHandshakeResponse* response);
130  void DidCloseWebSocket([Keep] ExecutionContext*, uint64_t identifier);
131  void DidReceiveWebSocketMessage(ExecutionContext*, uint64_t identifier, int opcode, bool masked, const Vector<base::span<const char>>& data);
132  void DidSendWebSocketMessage(ExecutionContext*, uint64_t identifier, int opcode, bool masked, const char* payload, size_t payload_length);
133  void DidReceiveWebSocketMessageError(ExecutionContext*, uint64_t identifier, const String& error_message);
134  void NetworkStateChanged([Keep] LocalFrame*, bool online);
135  void UpdateApplicationCacheStatus([Keep] LocalFrame*);
136  /* This is for pre-BlinkGenPropertyTrees. TODO(wangxianzhu): Remove this function for BlinkGenPropertyTrees. */
137  void LayerTreeDidChange(LocalFrame*);
138  /* For BlinkGenPropertyTrees/CompositeAfterPaint. */
139  void LayerTreePainted(LocalFrame*);
140  void PseudoElementCreated([Keep] PseudoElement*);
141  void PseudoElementDestroyed([Keep] PseudoElement*);
142  void DidCreateAnimation(Document*, unsigned);
143  void AnimationPlayStateChanged(Document*, Animation*, Animation::AnimationPlayState old_play_state, Animation::AnimationPlayState new_play_state);
144  void WindowOpen([Keep] Document*, const String& url, const AtomicString& window_name, const WebWindowFeatures& window_features, bool user_gestrue);
145  void ConsoleMessageAdded(ExecutionContext*, ConsoleMessage*);
146  void InspectorIssueAdded(ExecutionContext*, InspectorIssue*);
147  void WillRunJavaScriptDialog(LocalFrame* frame);
148  void DidRunJavaScriptDialog(LocalFrame* frame);
149  void DocumentWriteFetchScript([Keep] Document*);
150  void DidChangeViewport(LocalFrame* document);
151  void BreakableLocation(ExecutionContext* context, const char* name);
152  RecalculateStyle(Document* document);
153  UpdateLayout(Document* document);
154  ExecuteScript([Keep] ExecutionContext* context, const String& script_url);
155  CallFunction([Keep] ExecutionContext* context, v8::Local<v8::Function> function, int depth = 0);
156  UserCallback([Keep] ExecutionContext* context, const char* name, const AtomicString& atomic_name, bool recurring, EventTarget* event_target = nullptr);
157  V8Compile([Keep] ExecutionContext* context, const String& file_name, int line, int column);
158  ParseHTML(Document* document, HTMLDocumentParser* parser);
159  void ForcePseudoState([Keep] Element* element, CSSSelector::PseudoType pseudo_state, bool* result);
160  void ShouldForceCorsPreflight(ExecutionContext*, bool* result);
161  void ShouldBlockRequest(CoreProbeSink*, const KURL&, bool* result);
162  void ShouldBypassServiceWorker(ExecutionContext* context, bool* result);
163  void ConsoleTimeStamp(ExecutionContext*, const String& title);
164  void WillStartDebuggerTask(CoreProbeSink*);
165  void DidFinishDebuggerTask(CoreProbeSink*);
166  void LifecycleEvent([Keep] LocalFrame*, DocumentLoader*, const char* name, double timestamp);
167  void PaintTiming([Keep] Document*, const char* name, double timestamp);
168  void DidCreateAudioContext(Document*);
169  void DidCloseAudioContext(Document*);
170  void DidResumeAudioContext(Document*);
171  void DidSuspendAudioContext(Document*);
172  void ProduceCompilationCache(LocalFrame*, const ScriptSourceCode& source, v8::Local<v8::Script> script);
173  void ConsumeCompilationCache(ExecutionContext*, const ScriptSourceCode& source, v8::ScriptCompiler::CachedData** cached_data);
174  void NodeCreated([Keep] Node* node);
175  void PortalRemoteFrameCreated(Document*, HTMLPortalElement* portal_element);
176  void FileChooserOpened([Keep] LocalFrame* frame, HTMLInputElement* element, bool* intercepted);
177  void PlayerEventsAdded(LocalFrame* frame, String player_id, const Vector<InspectorPlayerEvent>& events);
178  void PlayerPropertiesChanged(LocalFrame* frame, String player_id, const Vector<InspectorPlayerProperty>& properties);
179  void PlayersCreated(LocalFrame* frame, const Vector<WebString>& players);
180}
181