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

Side by Side Diff: src/inspector/injected-script.h

Issue 2916803005: [inspector] Create InjectedScript per session in each context (Closed)
Patch Set: rebased Created 3 years, 6 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
« no previous file with comments | « no previous file | src/inspector/injected-script.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 class RemoteObjectId; 47 class RemoteObjectId;
48 class V8FunctionCall; 48 class V8FunctionCall;
49 class V8InspectorImpl; 49 class V8InspectorImpl;
50 class V8InspectorSessionImpl; 50 class V8InspectorSessionImpl;
51 51
52 using protocol::Maybe; 52 using protocol::Maybe;
53 using protocol::Response; 53 using protocol::Response;
54 54
55 class InjectedScript final { 55 class InjectedScript final {
56 public: 56 public:
57 static std::unique_ptr<InjectedScript> create(InspectedContext*); 57 static std::unique_ptr<InjectedScript> create(InspectedContext*,
58 int sessionId);
58 ~InjectedScript(); 59 ~InjectedScript();
59 static InjectedScript* fromInjectedScriptHost(v8::Isolate* isolate, 60 static InjectedScript* fromInjectedScriptHost(v8::Isolate* isolate,
60 v8::Local<v8::Object>); 61 v8::Local<v8::Object>);
61 62
62 InspectedContext* context() const { return m_context; } 63 InspectedContext* context() const { return m_context; }
63 64
64 Response getProperties( 65 Response getProperties(
65 v8::Local<v8::Object>, const String16& groupName, bool ownProperties, 66 v8::Local<v8::Object>, const String16& groupName, bool ownProperties,
66 bool accessorPropertiesOnly, bool generatePreview, 67 bool accessorPropertiesOnly, bool generatePreview,
67 std::unique_ptr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* 68 std::unique_ptr<protocol::Array<protocol::Runtime::PropertyDescriptor>>*
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 175
175 private: 176 private:
176 Response findInjectedScript(V8InspectorSessionImpl*) override; 177 Response findInjectedScript(V8InspectorSessionImpl*) override;
177 String16 m_remoteCallFrameId; 178 String16 m_remoteCallFrameId;
178 size_t m_frameOrdinal; 179 size_t m_frameOrdinal;
179 180
180 DISALLOW_COPY_AND_ASSIGN(CallFrameScope); 181 DISALLOW_COPY_AND_ASSIGN(CallFrameScope);
181 }; 182 };
182 183
183 private: 184 private:
184 InjectedScript(InspectedContext*, v8::Local<v8::Object>); 185 InjectedScript(InspectedContext*, v8::Local<v8::Object>, int sessionId);
185 v8::Local<v8::Value> v8Value() const; 186 v8::Local<v8::Value> v8Value() const;
186 Response wrapValue(v8::Local<v8::Value>, const String16& groupName, 187 Response wrapValue(v8::Local<v8::Value>, const String16& groupName,
187 bool forceValueType, bool generatePreview, 188 bool forceValueType, bool generatePreview,
188 v8::Local<v8::Value>* result) const; 189 v8::Local<v8::Value>* result) const;
189 v8::Local<v8::Object> commandLineAPI(); 190 v8::Local<v8::Object> commandLineAPI();
190 void unbindObject(int id); 191 void unbindObject(int id);
191 192
192 InspectedContext* m_context; 193 InspectedContext* m_context;
193 v8::Global<v8::Value> m_value; 194 v8::Global<v8::Value> m_value;
195 int m_sessionId;
194 v8::Global<v8::Value> m_lastEvaluationResult; 196 v8::Global<v8::Value> m_lastEvaluationResult;
195 v8::Global<v8::Object> m_commandLineAPI; 197 v8::Global<v8::Object> m_commandLineAPI;
196 int m_lastBoundObjectId = 1; 198 int m_lastBoundObjectId = 1;
197 std::unordered_map<int, v8::Global<v8::Value>> m_idToWrappedObject; 199 std::unordered_map<int, v8::Global<v8::Value>> m_idToWrappedObject;
198 std::unordered_map<int, String16> m_idToObjectGroupName; 200 std::unordered_map<int, String16> m_idToObjectGroupName;
199 std::unordered_map<String16, std::vector<int>> m_nameToObjectGroup; 201 std::unordered_map<String16, std::vector<int>> m_nameToObjectGroup;
200 202
201 DISALLOW_COPY_AND_ASSIGN(InjectedScript); 203 DISALLOW_COPY_AND_ASSIGN(InjectedScript);
202 }; 204 };
203 205
204 } // namespace v8_inspector 206 } // namespace v8_inspector
205 207
206 #endif // V8_INSPECTOR_INJECTEDSCRIPT_H_ 208 #endif // V8_INSPECTOR_INJECTEDSCRIPT_H_
OLDNEW
« no previous file with comments | « no previous file | src/inspector/injected-script.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698