Add on-device JSC inspector

Summary:
Introduces the inspector library supporting the Chrome Debugging Protocol for JavaScriptCore. Eventually this will mean that it is possible to attach
the Chrome inspector directly to the JSC instance running on the device. This library doesn't define the actual transport but leaves that up to the platform
layer.

The main entry point (and the only exported header) is `Inspector.h`.

This diff only introduces the basics supporting the `Schema` and `Inspector` domains meaning it doesn't have any features yet. These will come in following
diffs.

Reviewed By: michalgr

Differential Revision: D4021490

fbshipit-source-id: 517fd9033051c11ba97d312b16382445ae85d3f3
This commit is contained in:
Alexander Blom
2016-11-02 12:18:11 -07:00
committed by Facebook Github Bot
parent 9bfd95c8aa
commit 156e5d9837
22 changed files with 1007 additions and 0 deletions

View File

@@ -19,6 +19,10 @@
#include <jschelpers/JSCHelpers.h>
#include <jschelpers/Value.h>
#ifdef WITH_INSPECTOR
#include <inspector/Inspector.h>
#endif
#include "Platform.h"
#include "SystraceSection.h"
#include "JSCNativeModules.h"
@@ -229,6 +233,10 @@ void JSCExecutor::initOnJSVMThread() throw(JSException) {
// Add a pointer to ourselves so we can retrieve it later in our hooks
JSObjectSetPrivate(JSContextGetGlobalObject(m_context), this);
#ifdef WITH_INSPECTOR
Inspector::instance().registerGlobalContext("main", m_context);
#endif
installNativeHook<&JSCExecutor::nativeFlushQueueImmediate>("nativeFlushQueueImmediate");
installNativeHook<&JSCExecutor::nativeCallSyncHook>("nativeCallSyncHook");
@@ -283,6 +291,10 @@ void JSCExecutor::terminateOnJSVMThread() {
m_nativeModules.reset();
#ifdef WITH_INSPECTOR
Inspector::instance().unregisterGlobalContext(m_context);
#endif
JSGlobalContextRelease(m_context);
m_context = nullptr;
}