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

Side by Side Diff: third_party/WebKit/Source/core/probe/CoreProbes.h

Issue 2772613002: [instrumentation] Rename InspectorInstrumentation into CoreProbes (Closed)
Patch Set: fix typo Created 3 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 /* 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
11 * copyright notice, this list of conditions and the following disclaimer 11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the 12 * in the documentation and/or other materials provided with the
13 * distribution. 13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its 14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from 15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission. 16 * this software without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 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. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef InspectorInstrumentation_h 31 #ifndef CoreProbes_h
32 #define InspectorInstrumentation_h 32 #define CoreProbes_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 #include "platform/probe/PlatformProbes.h"
39 40
40 namespace blink { 41 namespace blink {
41 42
42 class InspectorInstrumentationAgents; 43 class CoreProbeSink;
43 class Resource; 44 class Resource;
44 class ThreadDebugger; 45 class ThreadDebugger;
45 class WorkerGlobalScope; 46 class WorkerGlobalScope;
46 47
47 namespace probe { 48 namespace probe {
48 49
49 class CORE_EXPORT ProbeBase {
50 STACK_ALLOCATED()
51
52 public:
53 double captureStartTime() const;
54 double captureEndTime() const;
55 double duration() const;
56
57 private:
58 mutable double m_startTime = 0;
59 mutable double m_endTime = 0;
60 };
61
62 class CORE_EXPORT AsyncTask { 50 class CORE_EXPORT AsyncTask {
63 STACK_ALLOCATED(); 51 STACK_ALLOCATED();
64 52
65 public: 53 public:
66 AsyncTask(ExecutionContext*, 54 AsyncTask(ExecutionContext*,
67 void* task, 55 void* task,
68 const char* step = nullptr, 56 const char* step = nullptr,
69 bool enabled = true); 57 bool enabled = true);
70 ~AsyncTask(); 58 ~AsyncTask();
71 59
72 private: 60 private:
73 ThreadDebugger* m_debugger; 61 ThreadDebugger* m_debugger;
74 void* m_task; 62 void* m_task;
75 bool m_recurring; 63 bool m_recurring;
76 }; 64 };
77 65
78 // Called from generated instrumentation code. 66 // Called from generated instrumentation code.
79 CORE_EXPORT InspectorInstrumentationAgents* instrumentingAgentsFor( 67 CORE_EXPORT CoreProbeSink* toCoreProbeSink(WorkerGlobalScope*);
80 WorkerGlobalScope*); 68 CORE_EXPORT CoreProbeSink* toCoreProbeSinkForNonDocumentContext(
81 CORE_EXPORT InspectorInstrumentationAgents* 69 ExecutionContext*);
82 instrumentingAgentsForNonDocumentContext(ExecutionContext*);
83 70
84 inline InspectorInstrumentationAgents* instrumentingAgentsFor( 71 inline CoreProbeSink* toCoreProbeSink(LocalFrame* frame) {
85 LocalFrame* frame) {
86 return frame ? frame->instrumentingAgents() : nullptr; 72 return frame ? frame->instrumentingAgents() : nullptr;
87 } 73 }
88 74
89 inline InspectorInstrumentationAgents* instrumentingAgentsFor( 75 inline CoreProbeSink* toCoreProbeSink(Document& document) {
90 Document& document) {
91 LocalFrame* frame = document.frame(); 76 LocalFrame* frame = document.frame();
92 if (!frame && document.templateDocumentHost()) 77 if (!frame && document.templateDocumentHost())
93 frame = document.templateDocumentHost()->frame(); 78 frame = document.templateDocumentHost()->frame();
94 return instrumentingAgentsFor(frame); 79 return toCoreProbeSink(frame);
95 } 80 }
96 81
97 inline InspectorInstrumentationAgents* instrumentingAgentsFor( 82 inline CoreProbeSink* toCoreProbeSink(Document* document) {
98 Document* document) { 83 return document ? toCoreProbeSink(*document) : nullptr;
99 return document ? instrumentingAgentsFor(*document) : nullptr;
100 } 84 }
101 85
102 inline InspectorInstrumentationAgents* instrumentingAgentsFor( 86 inline CoreProbeSink* toCoreProbeSink(ExecutionContext* context) {
103 ExecutionContext* context) {
104 if (!context) 87 if (!context)
105 return nullptr; 88 return nullptr;
106 return context->isDocument() 89 return context->isDocument() ? toCoreProbeSink(*toDocument(context))
107 ? instrumentingAgentsFor(*toDocument(context)) 90 : toCoreProbeSinkForNonDocumentContext(context);
108 : instrumentingAgentsForNonDocumentContext(context);
109 } 91 }
110 92
111 inline InspectorInstrumentationAgents* instrumentingAgentsFor(Node* node) { 93 inline CoreProbeSink* toCoreProbeSink(Node* node) {
112 return node ? instrumentingAgentsFor(node->document()) : nullptr; 94 return node ? toCoreProbeSink(node->document()) : nullptr;
113 } 95 }
114 96
115 inline InspectorInstrumentationAgents* instrumentingAgentsFor( 97 inline CoreProbeSink* toCoreProbeSink(EventTarget* eventTarget) {
116 EventTarget* eventTarget) { 98 return eventTarget ? toCoreProbeSink(eventTarget->getExecutionContext())
117 return eventTarget 99 : nullptr;
118 ? instrumentingAgentsFor(eventTarget->getExecutionContext())
119 : nullptr;
120 } 100 }
121 101
122 CORE_EXPORT void asyncTaskScheduled(ExecutionContext*, 102 CORE_EXPORT void asyncTaskScheduled(ExecutionContext*,
123 const String& name, 103 const String& name,
124 void*); 104 void*);
125 CORE_EXPORT void asyncTaskScheduledBreakable(ExecutionContext*, 105 CORE_EXPORT void asyncTaskScheduledBreakable(ExecutionContext*,
126 const char* name, 106 const char* name,
127 void*); 107 void*);
128 CORE_EXPORT void asyncTaskCanceled(ExecutionContext*, void*); 108 CORE_EXPORT void asyncTaskCanceled(ExecutionContext*, void*);
129 CORE_EXPORT void asyncTaskCanceledBreakable(ExecutionContext*, 109 CORE_EXPORT void asyncTaskCanceledBreakable(ExecutionContext*,
130 const char* name, 110 const char* name,
131 void*); 111 void*);
132 112
133 CORE_EXPORT void allAsyncTasksCanceled(ExecutionContext*); 113 CORE_EXPORT void allAsyncTasksCanceled(ExecutionContext*);
134 CORE_EXPORT void canceledAfterReceivedResourceResponse(LocalFrame*, 114 CORE_EXPORT void canceledAfterReceivedResourceResponse(LocalFrame*,
135 DocumentLoader*, 115 DocumentLoader*,
136 unsigned long identifier, 116 unsigned long identifier,
137 const ResourceResponse&, 117 const ResourceResponse&,
138 Resource*); 118 Resource*);
139 CORE_EXPORT void continueWithPolicyIgnore(LocalFrame*, 119 CORE_EXPORT void continueWithPolicyIgnore(LocalFrame*,
140 DocumentLoader*, 120 DocumentLoader*,
141 unsigned long identifier, 121 unsigned long identifier,
142 const ResourceResponse&, 122 const ResourceResponse&,
143 Resource*); 123 Resource*);
144 124
145 } // namespace probe 125 } // namespace probe
146 } // namespace blink 126 } // namespace blink
147 127
148 #include "core/InspectorInstrumentationInl.h" 128 #undef PROBE_EXPORT
129
130 #include "core/CoreProbesInl.h"
149 #include "core/InspectorOverridesInl.h" 131 #include "core/InspectorOverridesInl.h"
150 132
151 #endif // !defined(InspectorInstrumentation_h) 133 #endif // !defined(CoreProbes_h)
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/probe/BUILD.gn ('k') | third_party/WebKit/Source/core/probe/CoreProbes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698