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> | 8 #include <unordered_map> |
9 #include <unordered_set> | 9 #include <unordered_set> |
10 | 10 |
11 #include "src/base/macros.h" | 11 #include "src/base/macros.h" |
12 #include "src/inspector/string-16.h" | 12 #include "src/inspector/string-16.h" |
13 | 13 |
14 #include "include/v8.h" | 14 #include "include/v8.h" |
15 | 15 |
16 namespace v8_inspector { | 16 namespace v8_inspector { |
17 | 17 |
18 class InjectedScript; | 18 class InjectedScript; |
(...skipping 13 matching lines...) Expand all Loading... | |
32 String16 origin() const { return m_origin; } | 32 String16 origin() const { return m_origin; } |
33 String16 humanReadableName() const { return m_humanReadableName; } | 33 String16 humanReadableName() const { return m_humanReadableName; } |
34 String16 auxData() const { return m_auxData; } | 34 String16 auxData() const { return m_auxData; } |
35 | 35 |
36 bool isReported(int sessionId) const; | 36 bool isReported(int sessionId) const; |
37 void setReported(int sessionId, bool reported); | 37 void setReported(int sessionId, bool reported); |
38 | 38 |
39 v8::Isolate* isolate() const; | 39 v8::Isolate* isolate() const; |
40 V8InspectorImpl* inspector() const { return m_inspector; } | 40 V8InspectorImpl* inspector() const { return m_inspector; } |
41 | 41 |
42 InjectedScript* getInjectedScript() { return m_injectedScript.get(); } | 42 InjectedScript* getAnyInjectedScript() { |
kozy
2017/06/03 11:16:15
Who use this method?
dgozman
2017/06/05 17:08:10
Left-over from partial testing :-) Removed.
| |
43 bool createInjectedScript(); | 43 return m_injectedScripts.empty() ? nullptr |
44 void discardInjectedScript(); | 44 : m_injectedScripts.begin()->second.get(); |
45 } | |
46 InjectedScript* getInjectedScript(int sessionId); | |
47 bool createInjectedScript(int sessionId); | |
48 void discardInjectedScript(int sessionId); | |
45 | 49 |
46 private: | 50 private: |
47 friend class V8InspectorImpl; | 51 friend class V8InspectorImpl; |
48 InspectedContext(V8InspectorImpl*, const V8ContextInfo&, int contextId); | 52 InspectedContext(V8InspectorImpl*, const V8ContextInfo&, int contextId); |
49 | 53 |
50 V8InspectorImpl* m_inspector; | 54 V8InspectorImpl* m_inspector; |
51 v8::Global<v8::Context> m_context; | 55 v8::Global<v8::Context> m_context; |
52 int m_contextId; | 56 int m_contextId; |
53 int m_contextGroupId; | 57 int m_contextGroupId; |
54 const String16 m_origin; | 58 const String16 m_origin; |
55 const String16 m_humanReadableName; | 59 const String16 m_humanReadableName; |
56 const String16 m_auxData; | 60 const String16 m_auxData; |
57 std::unordered_set<int> m_reportedSessionIds; | 61 std::unordered_set<int> m_reportedSessionIds; |
58 std::unique_ptr<InjectedScript> m_injectedScript; | 62 std::unordered_map<int, std::unique_ptr<InjectedScript>> m_injectedScripts; |
59 | 63 |
60 DISALLOW_COPY_AND_ASSIGN(InspectedContext); | 64 DISALLOW_COPY_AND_ASSIGN(InspectedContext); |
61 }; | 65 }; |
62 | 66 |
63 } // namespace v8_inspector | 67 } // namespace v8_inspector |
64 | 68 |
65 #endif // V8_INSPECTOR_INSPECTEDCONTEXT_H_ | 69 #endif // V8_INSPECTOR_INSPECTEDCONTEXT_H_ |
OLD | NEW |