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

Side by Side Diff: test/inspector-protocol/task.h

Issue 2358943002: [inspector] added inspector protocol test runner (Closed)
Patch Set: a Created 4 years, 2 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef V8_TEST_INSPECTOR_PROTOCOL_TASK_H_
6 #define V8_TEST_INSPECTOR_PROTOCOL_TASK_H_
7
8 #include "include/v8-inspector.h"
9 #include "include/v8-platform.h"
10 #include "include/v8.h"
11 #include "src/base/macros.h"
12 #include "src/inspector/string-16.h"
13
14 namespace v8 {
15 namespace base {
16 class Semaphore;
17 } // base
18 } // v8
19
20 namespace v8_inspector {
21
22 class TaskRunner;
23
24 class TaskScope {
25 public:
26 TaskScope(v8::Isolate* isolate, const v8::Global<v8::Context>& context);
27 ~TaskScope();
28
29 v8::Local<v8::Context> context() { return context_; }
30
31 private:
32 v8::Isolate* isolate_;
33 v8::Isolate::Scope isolate_scope_;
34 v8::HandleScope handle_scope_;
35 v8::Local<v8::Context> context_;
36 v8::Context::Scope context_scope_;
37 v8::MicrotasksScope microtasks_scope_;
38 v8::TryCatch try_catch_;
39
40 DISALLOW_COPY_AND_ASSIGN(TaskScope);
41 };
42
43 class Task : public v8::Task {
44 public:
45 virtual bool is_protocol_task() = 0;
46 virtual void Run(v8::Isolate* isolate,
47 const v8::Global<v8::Context>& context) {
48 DCHECK(false);
49 }
50 virtual void Run() { DCHECK(false); }
51 };
52
53 class ExecuteStringTask : public Task {
54 public:
55 explicit ExecuteStringTask(const StringView& expression);
56 bool is_protocol_task() { return false; }
57
58 void Run(v8::Isolate* isolate, const v8::Global<v8::Context>& global_context);
59
60 private:
61 String16 expression_;
62
63 DISALLOW_COPY_AND_ASSIGN(ExecuteStringTask);
64 };
65
66 class InitTask : public v8_inspector::Task {
67 public:
68 InitTask(v8::ExtensionConfiguration* extensions,
69 v8_inspector::TaskRunner* task_runner, v8::base::Semaphore* ready);
70
71 bool is_protocol_task() final { return true; }
72
73 void Run() override;
74
75 private:
76 v8::ExtensionConfiguration* extensions_;
77 v8_inspector::TaskRunner* task_runner_;
78 v8::base::Semaphore* ready_;
79
80 DISALLOW_COPY_AND_ASSIGN(InitTask);
81 };
82
83 } // v8_inspector
84
85 #endif // V8_TEST_INSPECTOR_PROTOCOL_TASK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698