Index: test/inspector-protocol/inspector-extension.h |
diff --git a/test/inspector-protocol/inspector-extension.h b/test/inspector-protocol/inspector-extension.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..150054bc5bcb1c4679e882e8d01df2ae72e4d829 |
--- /dev/null |
+++ b/test/inspector-protocol/inspector-extension.h |
@@ -0,0 +1,54 @@ |
+// 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_INSPECTOR_EXTENSION_H_ |
+#define V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_EXTENSION_H_ |
+ |
+#include "include/v8.h" |
+ |
+namespace v8_inspector { |
+ |
+class TaskQueue; |
+ |
+class BackendExtension : public v8::Extension { |
+ public: |
+ BackendExtension() |
+ : v8::Extension("v8_inspector/backend", |
+ "native function evaluateInFrontend();") {} |
+ virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( |
+ v8::Isolate* isolate, v8::Local<v8::String> name); |
+ |
+ static void set_frontend_task_queue(TaskQueue* queue) { |
+ frontend_queue_ = queue; |
+ } |
+ |
+ private: |
+ static void EvaluateInFrontend( |
+ const v8::FunctionCallbackInfo<v8::Value>& args); |
+ |
+ static TaskQueue* frontend_queue_; |
+}; |
+ |
+class FrontendExtension : public v8::Extension { |
+ public: |
+ FrontendExtension() |
+ : v8::Extension("v8_inspector/frontend", |
+ "native function sendMessageToBackend();") {} |
+ virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( |
+ v8::Isolate* isolate, v8::Local<v8::String> name); |
+ |
+ static void set_backend_task_queue(TaskQueue* queue) { |
+ backend_queue_ = queue; |
+ } |
+ |
+ private: |
+ static void SendMessageToBackend( |
+ const v8::FunctionCallbackInfo<v8::Value>& args); |
+ |
+ static TaskQueue* backend_queue_; |
+}; |
+ |
+} // namespace v8_inspector |
+ |
+#endif // V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_EXTENSION_H_ |