| Index: test/inspector-protocol/task.h
|
| diff --git a/test/inspector-protocol/task.h b/test/inspector-protocol/task.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a5674274eadde4d376a729771ead214879e9823a
|
| --- /dev/null
|
| +++ b/test/inspector-protocol/task.h
|
| @@ -0,0 +1,85 @@
|
| +// Copyright 2016 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_TASK_H_
|
| +#define V8_TEST_INSPECTOR_PROTOCOL_TASK_H_
|
| +
|
| +#include "include/v8-inspector.h"
|
| +#include "include/v8-platform.h"
|
| +#include "include/v8.h"
|
| +#include "src/base/macros.h"
|
| +#include "src/inspector/string-16.h"
|
| +
|
| +namespace v8 {
|
| +namespace base {
|
| +class Semaphore;
|
| +} // base
|
| +} // v8
|
| +
|
| +namespace v8_inspector {
|
| +
|
| +class TaskRunner;
|
| +
|
| +class TaskScope {
|
| + public:
|
| + TaskScope(v8::Isolate* isolate, const v8::Global<v8::Context>& context);
|
| + ~TaskScope();
|
| +
|
| + v8::Local<v8::Context> context() { return context_; }
|
| +
|
| + private:
|
| + v8::Isolate* isolate_;
|
| + v8::Isolate::Scope isolate_scope_;
|
| + v8::HandleScope handle_scope_;
|
| + v8::Local<v8::Context> context_;
|
| + v8::Context::Scope context_scope_;
|
| + v8::MicrotasksScope microtasks_scope_;
|
| + v8::TryCatch try_catch_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(TaskScope);
|
| +};
|
| +
|
| +class Task : public v8::Task {
|
| + public:
|
| + virtual bool is_protocol_task() = 0;
|
| + virtual void Run(v8::Isolate* isolate,
|
| + const v8::Global<v8::Context>& context) {
|
| + DCHECK(false);
|
| + }
|
| + virtual void Run() { DCHECK(false); }
|
| +};
|
| +
|
| +class ExecuteStringTask : public Task {
|
| + public:
|
| + explicit ExecuteStringTask(const StringView& expression);
|
| + bool is_protocol_task() { return false; }
|
| +
|
| + void Run(v8::Isolate* isolate, const v8::Global<v8::Context>& global_context);
|
| +
|
| + private:
|
| + String16 expression_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ExecuteStringTask);
|
| +};
|
| +
|
| +class InitTask : public v8_inspector::Task {
|
| + public:
|
| + InitTask(v8::ExtensionConfiguration* extensions,
|
| + v8_inspector::TaskRunner* task_runner, v8::base::Semaphore* ready);
|
| +
|
| + bool is_protocol_task() final { return true; }
|
| +
|
| + void Run() override;
|
| +
|
| + private:
|
| + v8::ExtensionConfiguration* extensions_;
|
| + v8_inspector::TaskRunner* task_runner_;
|
| + v8::base::Semaphore* ready_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(InitTask);
|
| +};
|
| +
|
| +} // v8_inspector
|
| +
|
| +#endif // V8_TEST_INSPECTOR_PROTOCOL_TASK_H_
|
|
|