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 | |
8 #include "src/base/macros.h" | 10 #include "src/base/macros.h" |
9 #include "src/inspector/string-16.h" | 11 #include "src/inspector/string-16.h" |
10 | 12 |
11 #include "include/v8.h" | 13 #include "include/v8.h" |
12 | 14 |
13 namespace v8_inspector { | 15 namespace v8_inspector { |
14 | 16 |
15 class InjectedScript; | 17 class InjectedScript; |
16 class InjectedScriptHost; | 18 class InjectedScriptHost; |
17 class V8ContextInfo; | 19 class V8ContextInfo; |
18 class V8InspectorImpl; | 20 class V8InspectorImpl; |
19 | 21 |
20 class InspectedContext { | 22 class InspectedContext { |
21 public: | 23 public: |
22 ~InspectedContext(); | 24 ~InspectedContext(); |
23 | 25 |
24 static int contextId(v8::Local<v8::Context>); | 26 static int contextId(v8::Local<v8::Context>); |
25 | 27 |
26 v8::Local<v8::Context> context() const; | 28 v8::Local<v8::Context> context() const; |
27 int contextId() const { return m_contextId; } | 29 int contextId() const { return m_contextId; } |
28 int contextGroupId() const { return m_contextGroupId; } | 30 int contextGroupId() const { return m_contextGroupId; } |
29 String16 origin() const { return m_origin; } | 31 String16 origin() const { return m_origin; } |
30 String16 humanReadableName() const { return m_humanReadableName; } | 32 String16 humanReadableName() const { return m_humanReadableName; } |
31 String16 auxData() const { return m_auxData; } | 33 String16 auxData() const { return m_auxData; } |
32 | 34 |
33 bool isReported() const { return m_reported; } | 35 bool isReported(int session_id) { return m_reported[session_id]; } |
kozy
2017/06/01 09:43:45
auto it = m_reported.find(session_id);
return it !
dgozman
2017/06/01 21:04:59
Done.
| |
34 void setReported(bool reported) { m_reported = reported; } | 36 void setReported(int session_id, bool reported) { |
37 m_reported[session_id] = reported; | |
38 } | |
35 | 39 |
36 v8::Isolate* isolate() const; | 40 v8::Isolate* isolate() const; |
37 V8InspectorImpl* inspector() const { return m_inspector; } | 41 V8InspectorImpl* inspector() const { return m_inspector; } |
38 | 42 |
39 InjectedScript* getInjectedScript() { return m_injectedScript.get(); } | 43 InjectedScript* getInjectedScript() { return m_injectedScript.get(); } |
40 bool createInjectedScript(); | 44 bool createInjectedScript(); |
41 void discardInjectedScript(); | 45 void discardInjectedScript(); |
42 | 46 |
43 private: | 47 private: |
44 friend class V8InspectorImpl; | 48 friend class V8InspectorImpl; |
45 InspectedContext(V8InspectorImpl*, const V8ContextInfo&, int contextId); | 49 InspectedContext(V8InspectorImpl*, const V8ContextInfo&, int contextId); |
46 | 50 |
47 V8InspectorImpl* m_inspector; | 51 V8InspectorImpl* m_inspector; |
48 v8::Global<v8::Context> m_context; | 52 v8::Global<v8::Context> m_context; |
49 int m_contextId; | 53 int m_contextId; |
50 int m_contextGroupId; | 54 int m_contextGroupId; |
51 const String16 m_origin; | 55 const String16 m_origin; |
52 const String16 m_humanReadableName; | 56 const String16 m_humanReadableName; |
53 const String16 m_auxData; | 57 const String16 m_auxData; |
54 bool m_reported; | 58 std::map<int, bool> m_reported; |
kozy
2017/06/01 09:43:45
can it be a set of session_ids where context was r
dgozman
2017/06/01 16:06:48
Totally!
| |
55 std::unique_ptr<InjectedScript> m_injectedScript; | 59 std::unique_ptr<InjectedScript> m_injectedScript; |
56 | 60 |
57 DISALLOW_COPY_AND_ASSIGN(InspectedContext); | 61 DISALLOW_COPY_AND_ASSIGN(InspectedContext); |
58 }; | 62 }; |
59 | 63 |
60 } // namespace v8_inspector | 64 } // namespace v8_inspector |
61 | 65 |
62 #endif // V8_INSPECTOR_INSPECTEDCONTEXT_H_ | 66 #endif // V8_INSPECTOR_INSPECTEDCONTEXT_H_ |
OLD | NEW |