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

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

Issue 2737603006: [inspector] added createContextGroup for tests (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | test/inspector/inspector-impl.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 // 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); 28 void scheduleReconnect(v8::base::Semaphore* ready_semaphore);
29 void scheduleCreateContextGroup(v8::ExtensionConfiguration* extensions,
30 v8::base::Semaphore* ready_semaphore,
31 int* context_group_id);
29 32
30 static v8_inspector::V8Inspector* InspectorFromContext( 33 static v8_inspector::V8Inspector* InspectorFromContext(
31 v8::Local<v8::Context> context); 34 v8::Local<v8::Context> context);
32 static v8_inspector::V8InspectorSession* SessionFromContext( 35 static v8_inspector::V8InspectorSession* SessionFromContext(
33 v8::Local<v8::Context> context); 36 v8::Local<v8::Context> context);
34 37
38 v8_inspector::V8InspectorSession* session(int context_group_id = 0);
dgozman 2017/03/07 21:47:14 Note that inspector always assumes that context gr
kozy 2017/03/07 22:06:14 addded a comment.
39
35 void setCurrentTimeMSForTest(double time); 40 void setCurrentTimeMSForTest(double time);
36 41
37 v8_inspector::V8InspectorSession* session() const { return session_.get(); }
38
39 private: 42 private:
40 // V8InspectorClient implementation. 43 // V8InspectorClient implementation.
41 bool formatAccessorsAsProperties(v8::Local<v8::Value>) override; 44 bool formatAccessorsAsProperties(v8::Local<v8::Value>) override;
42 v8::Local<v8::Context> ensureDefaultContextInGroup( 45 v8::Local<v8::Context> ensureDefaultContextInGroup(
43 int context_group_id) override; 46 int context_group_id) override;
44 double currentTimeMS() override; 47 double currentTimeMS() override;
45 void runMessageLoopOnPause(int context_group_id) override; 48 void runMessageLoopOnPause(int context_group_id) override;
46 void quitMessageLoopOnPause() override; 49 void quitMessageLoopOnPause() override;
47 50
48 friend class SendMessageToBackendTask; 51 friend class SendMessageToBackendTask;
49 52
50 friend class ConnectTask; 53 friend class ConnectTask;
51 void connect(v8::Local<v8::Context> context); 54 void connect(v8::Local<v8::Context> context);
52 friend class DisconnectTask; 55 friend class DisconnectTask;
53 void disconnect(); 56 void disconnect();
57 friend class CreateContextGroupTask;
58 int createContextGroup(v8::ExtensionConfiguration* extensions);
54 59
55 std::unique_ptr<v8_inspector::V8Inspector> inspector_; 60 std::unique_ptr<v8_inspector::V8Inspector> inspector_;
56 std::unique_ptr<v8_inspector::V8InspectorSession> session_;
57 std::unique_ptr<v8_inspector::V8Inspector::Channel> channel_; 61 std::unique_ptr<v8_inspector::V8Inspector::Channel> channel_;
58 std::unique_ptr<v8_inspector::StringBuffer> state_; 62
63 std::map<int, std::unique_ptr<v8_inspector::V8InspectorSession>> sessions_;
64 std::map<int, std::unique_ptr<v8_inspector::StringBuffer>> states_;
59 65
60 v8::Isolate* isolate_; 66 v8::Isolate* isolate_;
61 v8::Global<v8::Context> context_;
62 67
63 TaskRunner* task_runner_; 68 TaskRunner* task_runner_;
64 FrontendChannel* frontend_channel_; 69 FrontendChannel* frontend_channel_;
65 70
66 bool current_time_set_for_test_ = false; 71 bool current_time_set_for_test_ = false;
67 double current_time_ = 0.0; 72 double current_time_ = 0.0;
68 73
69 DISALLOW_COPY_AND_ASSIGN(InspectorClientImpl); 74 DISALLOW_COPY_AND_ASSIGN(InspectorClientImpl);
70 }; 75 };
71 76
(...skipping 10 matching lines...) Expand all
82 } 87 }
83 88
84 private: 89 private:
85 static void SendMessageToBackend( 90 static void SendMessageToBackend(
86 const v8::FunctionCallbackInfo<v8::Value>& args); 91 const v8::FunctionCallbackInfo<v8::Value>& args);
87 92
88 static TaskRunner* backend_task_runner_; 93 static TaskRunner* backend_task_runner_;
89 }; 94 };
90 95
91 #endif // V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ 96 #endif // V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | test/inspector/inspector-impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698