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

Unified Diff: test/inspector/inspector-impl.cc

Issue 2713023004: [inspector] added reconnect method for tests (Closed)
Patch Set: rebased Created 3 years, 10 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-impl.h ('k') | test/inspector/inspector-test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/inspector-impl.cc
diff --git a/test/inspector/inspector-impl.cc b/test/inspector/inspector-impl.cc
index 3b0444037277bea759357adab7a4d7656cb802a4..637a739d2a9dd54471f363448a43f31b62702f09 100644
--- a/test/inspector/inspector-impl.cc
+++ b/test/inspector/inspector-impl.cc
@@ -108,6 +108,22 @@ class ConnectTask : public TaskRunner::Task {
v8::base::Semaphore* ready_semaphore_;
};
+class DisconnectTask : public TaskRunner::Task {
+ public:
+ explicit DisconnectTask(InspectorClientImpl* client) : client_(client) {}
+ virtual ~DisconnectTask() = default;
+
+ bool is_inspector_task() final { return true; }
+
+ void Run(v8::Isolate* isolate,
+ const v8::Global<v8::Context>& global_context) {
+ client_->disconnect();
+ }
+
+ private:
+ InspectorClientImpl* client_;
+};
+
InspectorClientImpl::InspectorClientImpl(TaskRunner* task_runner,
FrontendChannel* frontend_channel,
v8::base::Semaphore* ready_semaphore)
@@ -125,7 +141,9 @@ void InspectorClientImpl::connect(v8::Local<v8::Context> context) {
channel_.reset(new ChannelImpl(frontend_channel_));
inspector_ = v8_inspector::V8Inspector::create(isolate_, this);
- session_ = inspector_->connect(1, channel_.get(), v8_inspector::StringView());
+ v8_inspector::StringView state =
+ state_ ? state_->string() : v8_inspector::StringView();
+ session_ = inspector_->connect(1, channel_.get(), state);
context->SetAlignedPointerInEmbedderData(kInspectorClientIndex, this);
inspector_->contextCreated(
@@ -133,6 +151,17 @@ void InspectorClientImpl::connect(v8::Local<v8::Context> context) {
context_.Reset(isolate_, context);
}
+void InspectorClientImpl::scheduleReconnect(
+ v8::base::Semaphore* ready_semaphore) {
+ task_runner_->Append(new DisconnectTask(this));
+ task_runner_->Append(new ConnectTask(this, ready_semaphore));
+}
+
+void InspectorClientImpl::disconnect() {
+ state_ = session_->stateJSON();
+ session_.reset();
+}
+
v8::Local<v8::Context> InspectorClientImpl::ensureDefaultContextInGroup(int) {
CHECK(isolate_);
return context_.Get(isolate_);
« no previous file with comments | « test/inspector/inspector-impl.h ('k') | test/inspector/inspector-test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698