Alexander Blom 156e5d9837 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
2016-11-02 12:29:14 -07:00

78 lines
1.3 KiB
C++

// Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#include <string>
#include <folly/dynamic.h>
#include <folly/Optional.h>
namespace facebook {
namespace react {
class Method {
public:
static Method parse(const std::string& formatted);
Method(std::string domain, std::string name);
const std::string& domain() const {
return domain_;
}
const std::string& name() const {
return name_;
}
std::string formatted() const;
private:
std::string domain_;
std::string name_;
};
class Event {
public:
explicit Event(std::string domain, std::string method, folly::dynamic params);
operator std::string() const;
private:
Method method_;
folly::dynamic params_;
};
namespace Timestamp {
double now();
}
enum class ErrorCode {
ParseError = -32700,
InvalidRequest = -32600,
MethodNotFound = -32601,
InvalidParams = -32602,
InternalError = -32603,
ServerError = -32000,
};
class Error {
public:
Error(int callId, ErrorCode code, std::string message);
Error(ErrorCode code, std::string message);
const std::string& message() const {
return message_;
}
ErrorCode code() const {
return code_;
}
operator std::string() const;
private:
folly::Optional<int> callId_;
ErrorCode code_;
std::string message_;
};
}
}