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

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

Issue 2887013002: [inspector] Move IsolateData to a separate file (Closed)
Patch Set: Created 3 years, 7 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/inspector.gyp ('k') | test/inspector/isolate-data.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/isolate-data.h
diff --git a/test/inspector/isolate-data.h b/test/inspector/isolate-data.h
new file mode 100644
index 0000000000000000000000000000000000000000..8a5555d0518a2684e179efabd3b99f2a815e855f
--- /dev/null
+++ b/test/inspector/isolate-data.h
@@ -0,0 +1,62 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_TEST_INSPECTOR_PROTOCOL_ISOLATE_DATA_H_
+#define V8_TEST_INSPECTOR_PROTOCOL_ISOLATE_DATA_H_
+
+#include <map>
+
+#include "include/v8-inspector.h"
+#include "include/v8-platform.h"
+#include "include/v8.h"
+#include "src/vector.h"
+
+class TaskRunner;
+
+class IsolateData {
+ public:
+ class SetupGlobalTask {
+ public:
+ virtual ~SetupGlobalTask() = default;
+ virtual void Run(v8::Isolate* isolate,
+ v8::Local<v8::ObjectTemplate> global) = 0;
+ };
+ using SetupGlobalTasks = std::vector<std::unique_ptr<SetupGlobalTask>>;
+
+ IsolateData(TaskRunner* task_runner, SetupGlobalTasks setup_global_tasks,
+ v8::StartupData* startup_data);
+ static IsolateData* FromContext(v8::Local<v8::Context> context);
+
+ v8::Isolate* isolate() const { return isolate_; }
+ TaskRunner* task_runner() const { return task_runner_; }
+ int CreateContextGroup();
+ v8::Local<v8::Context> GetContext(int context_group_id);
+ void RegisterModule(v8::Local<v8::Context> context,
+ v8::internal::Vector<uint16_t> name,
+ v8::ScriptCompiler::Source* source);
+
+ private:
+ struct VectorCompare {
+ bool operator()(const v8::internal::Vector<uint16_t>& lhs,
+ const v8::internal::Vector<uint16_t>& rhs) const {
+ for (int i = 0; i < lhs.length() && i < rhs.length(); ++i) {
+ if (lhs[i] != rhs[i]) return lhs[i] < rhs[i];
+ }
+ return false;
+ }
+ };
+ static v8::MaybeLocal<v8::Module> ModuleResolveCallback(
+ v8::Local<v8::Context> context, v8::Local<v8::String> specifier,
+ v8::Local<v8::Module> referrer);
+
+ TaskRunner* task_runner_;
+ SetupGlobalTasks setup_global_tasks_;
+ v8::Isolate* isolate_;
+ int last_context_group_id_ = 0;
+ std::map<int, v8::Global<v8::Context>> contexts_;
+ std::map<v8::internal::Vector<uint16_t>, v8::Global<v8::Module>,
+ VectorCompare>
+ modules_;
+};
+#endif // V8_TEST_INSPECTOR_PROTOCOL_ISOLATE_DATA_H_
« no previous file with comments | « test/inspector/inspector.gyp ('k') | test/inspector/isolate-data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698