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

Unified Diff: test/inspector/isolate-data.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/inspector/isolate-data.h ('k') | test/inspector/protocol-test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/isolate-data.cc
diff --git a/test/inspector/isolate-data.cc b/test/inspector/isolate-data.cc
index f56b2578c1aca676d36da4c9bc4a678eae96f79f..74c367a5e9200e3d41ad6de7c44d65132497e1d2 100644
--- a/test/inspector/isolate-data.cc
+++ b/test/inspector/isolate-data.cc
@@ -39,6 +39,19 @@ void Print(v8::Isolate* isolate, const v8_inspector::StringView& string) {
fwrite(*utf8_string, sizeof(**utf8_string), utf8_string.length(), stdout);
}
+class Inspectable : public v8_inspector::V8InspectorSession::Inspectable {
+ public:
+ Inspectable(v8::Isolate* isolate, v8::Local<v8::Value> object)
+ : object_(isolate, object) {}
+ ~Inspectable() override {}
+ v8::Local<v8::Value> get(v8::Local<v8::Context> context) override {
+ return object_.Get(context->GetIsolate());
+ }
+
+ private:
+ v8::Global<v8::Value> object_;
+};
+
} // namespace
IsolateData::IsolateData(TaskRunner* task_runner,
@@ -183,6 +196,14 @@ void IsolateData::AsyncTaskFinished(void* task) {
inspector_->asyncTaskFinished(task);
}
+void IsolateData::AddInspectedObject(int session_id,
+ v8::Local<v8::Value> object) {
+ auto it = sessions_.find(session_id);
+ if (it == sessions_.end()) return;
+ std::unique_ptr<Inspectable> inspectable(new Inspectable(isolate_, object));
+ it->second->addInspectedObject(std::move(inspectable));
+}
+
void IsolateData::SetMaxAsyncTaskStacksForTest(int limit) {
v8_inspector::SetMaxAsyncTaskStacksForTest(inspector_.get(), limit);
}
« no previous file with comments | « test/inspector/isolate-data.h ('k') | test/inspector/protocol-test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698