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

Side by Side Diff: test/inspector/inspector-impl.h

Issue 2713023004: [inspector] added reconnect method for tests (Closed)
Patch Set: rebased Created 3 years, 9 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
OLDNEW
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_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ 5 #ifndef V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_
6 #define V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ 6 #define V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_
7 7
8 #include "include/v8-inspector.h" 8 #include "include/v8-inspector.h"
9 #include "include/v8.h" 9 #include "include/v8.h"
10 #include "src/base/macros.h" 10 #include "src/base/macros.h"
11 #include "src/base/platform/platform.h" 11 #include "src/base/platform/platform.h"
12 #include "test/inspector/task-runner.h" 12 #include "test/inspector/task-runner.h"
13 13
14 class InspectorClientImpl : public v8_inspector::V8InspectorClient { 14 class InspectorClientImpl : public v8_inspector::V8InspectorClient {
15 public: 15 public:
16 class FrontendChannel { 16 class FrontendChannel {
17 public: 17 public:
18 virtual ~FrontendChannel() = default; 18 virtual ~FrontendChannel() = default;
19 virtual void SendMessageToFrontend( 19 virtual void SendMessageToFrontend(
20 const v8_inspector::StringView& message) = 0; 20 const v8_inspector::StringView& message) = 0;
21 }; 21 };
22 22
23 InspectorClientImpl(TaskRunner* task_runner, 23 InspectorClientImpl(TaskRunner* task_runner,
24 FrontendChannel* frontend_channel, 24 FrontendChannel* frontend_channel,
25 v8::base::Semaphore* ready_semaphore); 25 v8::base::Semaphore* ready_semaphore);
26 virtual ~InspectorClientImpl(); 26 virtual ~InspectorClientImpl();
27 27
28 void scheduleReconnect(v8::base::Semaphore* ready_semaphore);
29
28 static v8_inspector::V8Inspector* InspectorFromContext( 30 static v8_inspector::V8Inspector* InspectorFromContext(
29 v8::Local<v8::Context> context); 31 v8::Local<v8::Context> context);
30 static v8_inspector::V8InspectorSession* SessionFromContext( 32 static v8_inspector::V8InspectorSession* SessionFromContext(
31 v8::Local<v8::Context> context); 33 v8::Local<v8::Context> context);
32 34
33 void setCurrentTimeMSForTest(double time); 35 void setCurrentTimeMSForTest(double time);
34 36
35 v8_inspector::V8InspectorSession* session() const { return session_.get(); } 37 v8_inspector::V8InspectorSession* session() const { return session_.get(); }
36 38
37 private: 39 private:
38 // V8InspectorClient implementation. 40 // V8InspectorClient implementation.
39 v8::Local<v8::Context> ensureDefaultContextInGroup( 41 v8::Local<v8::Context> ensureDefaultContextInGroup(
40 int context_group_id) override; 42 int context_group_id) override;
41 double currentTimeMS() override; 43 double currentTimeMS() override;
42 void runMessageLoopOnPause(int context_group_id) override; 44 void runMessageLoopOnPause(int context_group_id) override;
43 void quitMessageLoopOnPause() override; 45 void quitMessageLoopOnPause() override;
44 46
45 friend class SendMessageToBackendTask; 47 friend class SendMessageToBackendTask;
46 48
47 friend class ConnectTask; 49 friend class ConnectTask;
48 void connect(v8::Local<v8::Context> context); 50 void connect(v8::Local<v8::Context> context);
51 friend class DisconnectTask;
52 void disconnect();
49 53
50 std::unique_ptr<v8_inspector::V8Inspector> inspector_; 54 std::unique_ptr<v8_inspector::V8Inspector> inspector_;
51 std::unique_ptr<v8_inspector::V8InspectorSession> session_; 55 std::unique_ptr<v8_inspector::V8InspectorSession> session_;
52 std::unique_ptr<v8_inspector::V8Inspector::Channel> channel_; 56 std::unique_ptr<v8_inspector::V8Inspector::Channel> channel_;
57 std::unique_ptr<v8_inspector::StringBuffer> state_;
53 58
54 v8::Isolate* isolate_; 59 v8::Isolate* isolate_;
55 v8::Global<v8::Context> context_; 60 v8::Global<v8::Context> context_;
56 61
57 TaskRunner* task_runner_; 62 TaskRunner* task_runner_;
58 FrontendChannel* frontend_channel_; 63 FrontendChannel* frontend_channel_;
59 64
60 bool current_time_set_for_test_ = false; 65 bool current_time_set_for_test_ = false;
61 double current_time_ = 0.0; 66 double current_time_ = 0.0;
62 67
(...skipping 13 matching lines...) Expand all
76 } 81 }
77 82
78 private: 83 private:
79 static void SendMessageToBackend( 84 static void SendMessageToBackend(
80 const v8::FunctionCallbackInfo<v8::Value>& args); 85 const v8::FunctionCallbackInfo<v8::Value>& args);
81 86
82 static TaskRunner* backend_task_runner_; 87 static TaskRunner* backend_task_runner_;
83 }; 88 };
84 89
85 #endif // V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ 90 #endif // V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_
OLDNEW
« no previous file with comments | « test/inspector/heap-profiler/take-heap-snapshot-on-pause.js ('k') | test/inspector/inspector-impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698