OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_INSPECTOR_INSPECTEDCONTEXT_H_ | 5 #ifndef V8_INSPECTOR_INSPECTEDCONTEXT_H_ |
6 #define V8_INSPECTOR_INSPECTEDCONTEXT_H_ | 6 #define V8_INSPECTOR_INSPECTEDCONTEXT_H_ |
7 | 7 |
| 8 #include <map> |
| 9 #include <unordered_set> |
| 10 |
8 #include "src/base/macros.h" | 11 #include "src/base/macros.h" |
9 #include "src/inspector/string-16.h" | 12 #include "src/inspector/string-16.h" |
10 | 13 |
11 #include "include/v8.h" | 14 #include "include/v8.h" |
12 | 15 |
13 namespace v8_inspector { | 16 namespace v8_inspector { |
14 | 17 |
15 class InjectedScript; | 18 class InjectedScript; |
16 class InjectedScriptHost; | 19 class InjectedScriptHost; |
17 class V8ContextInfo; | 20 class V8ContextInfo; |
18 class V8InspectorImpl; | 21 class V8InspectorImpl; |
19 | 22 |
20 class InspectedContext { | 23 class InspectedContext { |
21 public: | 24 public: |
22 ~InspectedContext(); | 25 ~InspectedContext(); |
23 | 26 |
24 static int contextId(v8::Local<v8::Context>); | 27 static int contextId(v8::Local<v8::Context>); |
25 | 28 |
26 v8::Local<v8::Context> context() const; | 29 v8::Local<v8::Context> context() const; |
27 int contextId() const { return m_contextId; } | 30 int contextId() const { return m_contextId; } |
28 int contextGroupId() const { return m_contextGroupId; } | 31 int contextGroupId() const { return m_contextGroupId; } |
29 String16 origin() const { return m_origin; } | 32 String16 origin() const { return m_origin; } |
30 String16 humanReadableName() const { return m_humanReadableName; } | 33 String16 humanReadableName() const { return m_humanReadableName; } |
31 String16 auxData() const { return m_auxData; } | 34 String16 auxData() const { return m_auxData; } |
32 | 35 |
33 bool isReported() const { return m_reported; } | 36 bool isReported(int sessionId) const; |
34 void setReported(bool reported) { m_reported = reported; } | 37 void setReported(int sessionId, bool reported); |
35 | 38 |
36 v8::Isolate* isolate() const; | 39 v8::Isolate* isolate() const; |
37 V8InspectorImpl* inspector() const { return m_inspector; } | 40 V8InspectorImpl* inspector() const { return m_inspector; } |
38 | 41 |
39 InjectedScript* getInjectedScript() { return m_injectedScript.get(); } | 42 InjectedScript* getInjectedScript() { return m_injectedScript.get(); } |
40 bool createInjectedScript(); | 43 bool createInjectedScript(); |
41 void discardInjectedScript(); | 44 void discardInjectedScript(); |
42 | 45 |
43 private: | 46 private: |
44 friend class V8InspectorImpl; | 47 friend class V8InspectorImpl; |
45 InspectedContext(V8InspectorImpl*, const V8ContextInfo&, int contextId); | 48 InspectedContext(V8InspectorImpl*, const V8ContextInfo&, int contextId); |
46 | 49 |
47 V8InspectorImpl* m_inspector; | 50 V8InspectorImpl* m_inspector; |
48 v8::Global<v8::Context> m_context; | 51 v8::Global<v8::Context> m_context; |
49 int m_contextId; | 52 int m_contextId; |
50 int m_contextGroupId; | 53 int m_contextGroupId; |
51 const String16 m_origin; | 54 const String16 m_origin; |
52 const String16 m_humanReadableName; | 55 const String16 m_humanReadableName; |
53 const String16 m_auxData; | 56 const String16 m_auxData; |
54 bool m_reported; | 57 std::unordered_set<int> m_reportedSessionIds; |
55 std::unique_ptr<InjectedScript> m_injectedScript; | 58 std::unique_ptr<InjectedScript> m_injectedScript; |
56 | 59 |
57 DISALLOW_COPY_AND_ASSIGN(InspectedContext); | 60 DISALLOW_COPY_AND_ASSIGN(InspectedContext); |
58 }; | 61 }; |
59 | 62 |
60 } // namespace v8_inspector | 63 } // namespace v8_inspector |
61 | 64 |
62 #endif // V8_INSPECTOR_INSPECTEDCONTEXT_H_ | 65 #endif // V8_INSPECTOR_INSPECTEDCONTEXT_H_ |
OLD | NEW |