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

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

Issue 433653003: Support Promises event-based instrumentation on backend. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Disable PromiseTracker and REBASE Created 6 years, 4 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef PromiseTracker_h
6 #define PromiseTracker_h
7
8 #include "bindings/core/v8/ScopedPersistent.h"
9 #include "core/inspector/ScriptCallFrame.h"
10 #include "wtf/HashMap.h"
11 #include "wtf/Noncopyable.h"
12 #include "wtf/RefPtr.h"
13 #include "wtf/Vector.h"
14 #include "wtf/WeakPtr.h"
15 #include <v8.h>
16
17 namespace blink {
18
19 class ScriptState;
20
21 class PromiseTracker {
22 WTF_MAKE_NONCOPYABLE(PromiseTracker);
23 public:
24 PromiseTracker() : m_isEnabled(false) { }
25
26 bool isEnabled() const { return m_isEnabled; }
27 void enable();
28 void disable();
29
30 void clear();
31
32 void didReceiveV8PromiseEvent(ScriptState*, v8::Handle<v8::Object> promise, v8::Handle<v8::Value> parentPromise, int status);
33
34 class PromiseData : public RefCounted<PromiseData> {
35 public:
36 PromiseData(v8::Isolate*, int promiseHash, v8::Handle<v8::Object> promis e, v8::Handle<v8::Object> parentPromise, int status, bool captureStack = false);
37
38 int promiseHash() const { return m_promiseHash; }
39 ScopedPersistent<v8::Object>& promise() { return m_promise; }
40
41 private:
42 friend class PromiseTracker;
43
44 int m_promiseHash;
45
46 ScopedPersistent<v8::Object> m_promise;
47 ScriptCallFrame m_callFrame;
48 ScopedPersistent<v8::Object> m_parentPromise;
49 int m_status;
50
51 WeakPtrFactory<PromiseData> m_weakPtrFactory;
52 };
53
54 typedef Vector<RefPtr<PromiseData> > PromiseDataVector;
55 typedef HashMap<int, PromiseDataVector> PromiseDataMap;
56
57 private:
58 bool m_isEnabled;
59 PromiseDataMap m_promiseDataMap;
60 };
61
62 } // namespace blink
63
64 #endif // !defined(PromiseTracker_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698