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

Side by Side Diff: Source/core/inspector/AsyncCallStackTracker.h

Issue 131823003: DevTools: Implement async call stacks for Promises. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: addressed Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 26 matching lines...) Expand all
37 #include "wtf/HashSet.h" 37 #include "wtf/HashSet.h"
38 #include "wtf/Noncopyable.h" 38 #include "wtf/Noncopyable.h"
39 #include "wtf/PassRefPtr.h" 39 #include "wtf/PassRefPtr.h"
40 #include "wtf/RefPtr.h" 40 #include "wtf/RefPtr.h"
41 41
42 namespace WebCore { 42 namespace WebCore {
43 43
44 class EventListener; 44 class EventListener;
45 class EventTarget; 45 class EventTarget;
46 class ExecutionContext; 46 class ExecutionContext;
47 class ExecutionContextTask;
47 class MutationObserver; 48 class MutationObserver;
48 class XMLHttpRequest; 49 class XMLHttpRequest;
49 50
50 class AsyncCallStackTracker { 51 class AsyncCallStackTracker {
51 WTF_MAKE_NONCOPYABLE(AsyncCallStackTracker); 52 WTF_MAKE_NONCOPYABLE(AsyncCallStackTracker);
52 public: 53 public:
53 class AsyncCallStack : public RefCounted<AsyncCallStack> { 54 class AsyncCallStack : public RefCounted<AsyncCallStack> {
54 public: 55 public:
55 AsyncCallStack(const String&, const ScriptValue&); 56 AsyncCallStack(const String&, const ScriptValue&);
56 ~AsyncCallStack(); 57 ~AsyncCallStack();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 void didRemoveAllEventListeners(EventTarget*); 93 void didRemoveAllEventListeners(EventTarget*);
93 void willHandleEvent(EventTarget*, const AtomicString& eventType, EventListe ner*, bool useCapture); 94 void willHandleEvent(EventTarget*, const AtomicString& eventType, EventListe ner*, bool useCapture);
94 95
95 void willLoadXHR(XMLHttpRequest*, const ScriptValue& callFrames); 96 void willLoadXHR(XMLHttpRequest*, const ScriptValue& callFrames);
96 97
97 void didEnqueueMutationRecord(ExecutionContext*, MutationObserver*, const Sc riptValue& callFrames); 98 void didEnqueueMutationRecord(ExecutionContext*, MutationObserver*, const Sc riptValue& callFrames);
98 bool hasEnqueuedMutationRecord(ExecutionContext*, MutationObserver*); 99 bool hasEnqueuedMutationRecord(ExecutionContext*, MutationObserver*);
99 void didClearAllMutationRecords(ExecutionContext*, MutationObserver*); 100 void didClearAllMutationRecords(ExecutionContext*, MutationObserver*);
100 void willDeliverMutationRecords(ExecutionContext*, MutationObserver*); 101 void willDeliverMutationRecords(ExecutionContext*, MutationObserver*);
101 102
103 void didPostPromiseTask(ExecutionContext*, ExecutionContextTask*, bool isRes olved, const ScriptValue& callFrames);
104 void willPerformPromiseTask(ExecutionContext*, ExecutionContextTask*);
105
102 void didFireAsyncCall(); 106 void didFireAsyncCall();
103 void clear(); 107 void clear();
104 108
105 private: 109 private:
106 void willHandleXHREvent(XMLHttpRequest*, EventTarget*, const AtomicString& e ventType); 110 void willHandleXHREvent(XMLHttpRequest*, EventTarget*, const AtomicString& e ventType);
107 111
108 PassRefPtr<AsyncCallChain> createAsyncCallChain(const String& description, c onst ScriptValue& callFrames); 112 PassRefPtr<AsyncCallChain> createAsyncCallChain(const String& description, c onst ScriptValue& callFrames);
109 void setCurrentAsyncCallChain(PassRefPtr<AsyncCallChain>); 113 void setCurrentAsyncCallChain(PassRefPtr<AsyncCallChain>);
110 void clearCurrentAsyncCallChain(); 114 void clearCurrentAsyncCallChain();
111 static void ensureMaxAsyncCallChainDepth(AsyncCallChain*, unsigned); 115 static void ensureMaxAsyncCallChainDepth(AsyncCallChain*, unsigned);
112 static bool validateCallFrames(const ScriptValue& callFrames); 116 static bool validateCallFrames(const ScriptValue& callFrames);
113 117
114 class ExecutionContextData; 118 class ExecutionContextData;
115 ExecutionContextData* createContextDataIfNeeded(ExecutionContext*); 119 ExecutionContextData* createContextDataIfNeeded(ExecutionContext*);
116 120
117 unsigned m_maxAsyncCallStackDepth; 121 unsigned m_maxAsyncCallStackDepth;
118 RefPtr<AsyncCallChain> m_currentAsyncCallChain; 122 RefPtr<AsyncCallChain> m_currentAsyncCallChain;
119 unsigned m_nestedAsyncCallCount; 123 unsigned m_nestedAsyncCallCount;
120 typedef HashMap<ExecutionContext*, ExecutionContextData*> ExecutionContextDa taMap; 124 typedef HashMap<ExecutionContext*, ExecutionContextData*> ExecutionContextDa taMap;
121 ExecutionContextDataMap m_executionContextDataMap; 125 ExecutionContextDataMap m_executionContextDataMap;
122 }; 126 };
123 127
124 } // namespace WebCore 128 } // namespace WebCore
125 129
126 #endif // !defined(AsyncCallStackTracker_h) 130 #endif // !defined(AsyncCallStackTracker_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698