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

Side by Side Diff: third_party/WebKit/Source/core/inspector/InspectorInstrumentation.h

Issue 2760363002: [instrumentation] Generalize instrumentation to be used beyond the core layer (Closed)
Patch Set: Created 3 years, 9 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 21 matching lines...) Expand all
32 #define InspectorInstrumentation_h 32 #define InspectorInstrumentation_h
33 33
34 #include "core/CoreExport.h" 34 #include "core/CoreExport.h"
35 #include "core/dom/Document.h" 35 #include "core/dom/Document.h"
36 #include "core/dom/Node.h" 36 #include "core/dom/Node.h"
37 #include "core/frame/LocalFrame.h" 37 #include "core/frame/LocalFrame.h"
38 #include "core/page/ChromeClient.h" 38 #include "core/page/ChromeClient.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 class InstrumentingAgents; 42 class InspectorInstrumentationAgents;
43 class Resource; 43 class Resource;
44 class ThreadDebugger; 44 class ThreadDebugger;
45 class WorkerGlobalScope; 45 class WorkerGlobalScope;
46 46
47 namespace probe { 47 namespace probe {
48 48
49 class CORE_EXPORT ProbeBase { 49 class CORE_EXPORT ProbeBase {
50 STACK_ALLOCATED() 50 STACK_ALLOCATED()
51 51
52 public: 52 public:
(...skipping 16 matching lines...) Expand all
69 bool enabled = true); 69 bool enabled = true);
70 ~AsyncTask(); 70 ~AsyncTask();
71 71
72 private: 72 private:
73 ThreadDebugger* m_debugger; 73 ThreadDebugger* m_debugger;
74 void* m_task; 74 void* m_task;
75 bool m_recurring; 75 bool m_recurring;
76 }; 76 };
77 77
78 // Called from generated instrumentation code. 78 // Called from generated instrumentation code.
79 CORE_EXPORT InstrumentingAgents* instrumentingAgentsFor(WorkerGlobalScope*); 79 CORE_EXPORT InspectorInstrumentationAgents* instrumentingAgentsFor(
80 CORE_EXPORT InstrumentingAgents* instrumentingAgentsForNonDocumentContext( 80 WorkerGlobalScope*);
81 ExecutionContext*); 81 CORE_EXPORT InspectorInstrumentationAgents*
82 instrumentingAgentsForNonDocumentContext(ExecutionContext*);
82 83
83 inline InstrumentingAgents* instrumentingAgentsFor(LocalFrame* frame) { 84 inline InspectorInstrumentationAgents* instrumentingAgentsFor(
85 LocalFrame* frame) {
84 return frame ? frame->instrumentingAgents() : nullptr; 86 return frame ? frame->instrumentingAgents() : nullptr;
85 } 87 }
86 88
87 inline InstrumentingAgents* instrumentingAgentsFor(Document& document) { 89 inline InspectorInstrumentationAgents* instrumentingAgentsFor(
90 Document& document) {
88 LocalFrame* frame = document.frame(); 91 LocalFrame* frame = document.frame();
89 if (!frame && document.templateDocumentHost()) 92 if (!frame && document.templateDocumentHost())
90 frame = document.templateDocumentHost()->frame(); 93 frame = document.templateDocumentHost()->frame();
91 return instrumentingAgentsFor(frame); 94 return instrumentingAgentsFor(frame);
92 } 95 }
93 96
94 inline InstrumentingAgents* instrumentingAgentsFor(Document* document) { 97 inline InspectorInstrumentationAgents* instrumentingAgentsFor(
98 Document* document) {
95 return document ? instrumentingAgentsFor(*document) : nullptr; 99 return document ? instrumentingAgentsFor(*document) : nullptr;
96 } 100 }
97 101
98 inline InstrumentingAgents* instrumentingAgentsFor(ExecutionContext* context) { 102 inline InspectorInstrumentationAgents* instrumentingAgentsFor(
103 ExecutionContext* context) {
99 if (!context) 104 if (!context)
100 return nullptr; 105 return nullptr;
101 return context->isDocument() 106 return context->isDocument()
102 ? instrumentingAgentsFor(*toDocument(context)) 107 ? instrumentingAgentsFor(*toDocument(context))
103 : instrumentingAgentsForNonDocumentContext(context); 108 : instrumentingAgentsForNonDocumentContext(context);
104 } 109 }
105 110
106 inline InstrumentingAgents* instrumentingAgentsFor(Node* node) { 111 inline InspectorInstrumentationAgents* instrumentingAgentsFor(Node* node) {
107 return node ? instrumentingAgentsFor(node->document()) : nullptr; 112 return node ? instrumentingAgentsFor(node->document()) : nullptr;
108 } 113 }
109 114
110 inline InstrumentingAgents* instrumentingAgentsFor(EventTarget* eventTarget) { 115 inline InspectorInstrumentationAgents* instrumentingAgentsFor(
116 EventTarget* eventTarget) {
111 return eventTarget 117 return eventTarget
112 ? instrumentingAgentsFor(eventTarget->getExecutionContext()) 118 ? instrumentingAgentsFor(eventTarget->getExecutionContext())
113 : nullptr; 119 : nullptr;
114 } 120 }
115 121
116 CORE_EXPORT void asyncTaskScheduled(ExecutionContext*, 122 CORE_EXPORT void asyncTaskScheduled(ExecutionContext*,
117 const String& name, 123 const String& name,
118 void*); 124 void*);
119 CORE_EXPORT void asyncTaskScheduledBreakable(ExecutionContext*, 125 CORE_EXPORT void asyncTaskScheduledBreakable(ExecutionContext*,
120 const char* name, 126 const char* name,
121 void*); 127 void*);
122 CORE_EXPORT void asyncTaskCanceled(ExecutionContext*, void*); 128 CORE_EXPORT void asyncTaskCanceled(ExecutionContext*, void*);
123 CORE_EXPORT void asyncTaskCanceledBreakable(ExecutionContext*, 129 CORE_EXPORT void asyncTaskCanceledBreakable(ExecutionContext*,
124 const char* name, 130 const char* name,
125 void*); 131 void*);
126 132
127 CORE_EXPORT void allAsyncTasksCanceled(ExecutionContext*); 133 CORE_EXPORT void allAsyncTasksCanceled(ExecutionContext*);
128 CORE_EXPORT void canceledAfterReceivedResourceResponse(LocalFrame*, 134 CORE_EXPORT void canceledAfterReceivedResourceResponse(LocalFrame*,
129 DocumentLoader*, 135 DocumentLoader*,
130 unsigned long identifier, 136 unsigned long identifier,
131 const ResourceResponse&, 137 const ResourceResponse&,
132 Resource*); 138 Resource*);
133 CORE_EXPORT void continueWithPolicyIgnore(LocalFrame*, 139 CORE_EXPORT void continueWithPolicyIgnore(LocalFrame*,
134 DocumentLoader*, 140 DocumentLoader*,
135 unsigned long identifier, 141 unsigned long identifier,
136 const ResourceResponse&, 142 const ResourceResponse&,
137 Resource*); 143 Resource*);
138 144
139 } // namespace InspectorInstrumentation 145 } // namespace probe
140 } // namespace blink 146 } // namespace blink
141 147
142 #include "core/InspectorInstrumentationInl.h" 148 #include "core/InspectorInstrumentationInl.h"
143
144 #include "core/InspectorOverridesInl.h" 149 #include "core/InspectorOverridesInl.h"
145 150
146 #endif // !defined(InspectorInstrumentation_h) 151 #endif // !defined(InspectorInstrumentation_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698