Skip to content

Commit

Permalink
feat: Re-add V8 inspector sources
Browse files Browse the repository at this point in the history
These were removed in the upgrade to V8 10.3.22. Re-add them.
  • Loading branch information
ptomato committed Mar 20, 2023
1 parent d7d3d27 commit cfc7adf
Show file tree
Hide file tree
Showing 146 changed files with 26,770 additions and 1 deletion.
59 changes: 59 additions & 0 deletions NativeScript/include/inspector/Debugger.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// This file is generated by Exported_h.template.

// Copyright (c) 2016 The Chromium 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_inspector_protocol_Debugger_api_h
#define v8_inspector_protocol_Debugger_api_h

#include "v8-inspector.h"

namespace v8_inspector {
namespace protocol {

#ifndef v8_inspector_protocol_exported_api_h
#define v8_inspector_protocol_exported_api_h
class V8_EXPORT Exported {
public:
virtual void AppendSerialized(std::vector<uint8_t>* out) const = 0;

virtual ~Exported() { }
};
#endif // !defined(v8_inspector_protocol_exported_api_h)

namespace Debugger {
namespace API {

// ------------- Enums.

namespace Paused {
namespace ReasonEnum {
V8_EXPORT extern const char* Ambiguous;
V8_EXPORT extern const char* Assert;
V8_EXPORT extern const char* CSPViolation;
V8_EXPORT extern const char* DebugCommand;
V8_EXPORT extern const char* DOM;
V8_EXPORT extern const char* EventListener;
V8_EXPORT extern const char* Exception;
V8_EXPORT extern const char* Instrumentation;
V8_EXPORT extern const char* OOM;
V8_EXPORT extern const char* Other;
V8_EXPORT extern const char* PromiseRejection;
V8_EXPORT extern const char* XHR;
} // ReasonEnum
} // Paused

// ------------- Types.

class V8_EXPORT SearchMatch : public Exported {
public:
static std::unique_ptr<protocol::Debugger::API::SearchMatch> fromBinary(const uint8_t* data, size_t length);
};

} // namespace API
} // namespace Debugger
} // namespace v8_inspector
} // namespace protocol

#endif // !defined(v8_inspector_protocol_Debugger_api_h)
52 changes: 52 additions & 0 deletions NativeScript/include/inspector/Runtime.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// This file is generated by Exported_h.template.

// Copyright (c) 2016 The Chromium 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_inspector_protocol_Runtime_api_h
#define v8_inspector_protocol_Runtime_api_h

#include "v8-inspector.h"

namespace v8_inspector {
namespace protocol {

#ifndef v8_inspector_protocol_exported_api_h
#define v8_inspector_protocol_exported_api_h
class V8_EXPORT Exported {
public:
virtual void AppendSerialized(std::vector<uint8_t>* out) const = 0;

virtual ~Exported() { }
};
#endif // !defined(v8_inspector_protocol_exported_api_h)

namespace Runtime {
namespace API {

// ------------- Enums.

// ------------- Types.

class V8_EXPORT RemoteObject : public Exported {
public:
static std::unique_ptr<protocol::Runtime::API::RemoteObject> fromBinary(const uint8_t* data, size_t length);
};

class V8_EXPORT StackTrace : public Exported {
public:
static std::unique_ptr<protocol::Runtime::API::StackTrace> fromBinary(const uint8_t* data, size_t length);
};

class V8_EXPORT StackTraceId : public Exported {
public:
static std::unique_ptr<protocol::Runtime::API::StackTraceId> fromBinary(const uint8_t* data, size_t length);
};

} // namespace API
} // namespace Runtime
} // namespace v8_inspector
} // namespace protocol

#endif // !defined(v8_inspector_protocol_Runtime_api_h)
42 changes: 42 additions & 0 deletions NativeScript/include/inspector/Schema.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// This file is generated by Exported_h.template.

// Copyright (c) 2016 The Chromium 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_inspector_protocol_Schema_api_h
#define v8_inspector_protocol_Schema_api_h

#include "v8-inspector.h"

namespace v8_inspector {
namespace protocol {

#ifndef v8_inspector_protocol_exported_api_h
#define v8_inspector_protocol_exported_api_h
class V8_EXPORT Exported {
public:
virtual void AppendSerialized(std::vector<uint8_t>* out) const = 0;

virtual ~Exported() { }
};
#endif // !defined(v8_inspector_protocol_exported_api_h)

namespace Schema {
namespace API {

// ------------- Enums.

// ------------- Types.

class V8_EXPORT Domain : public Exported {
public:
static std::unique_ptr<protocol::Schema::API::Domain> fromBinary(const uint8_t* data, size_t length);
};

} // namespace API
} // namespace Schema
} // namespace v8_inspector
} // namespace protocol

#endif // !defined(v8_inspector_protocol_Schema_api_h)
95 changes: 95 additions & 0 deletions NativeScript/inspector/src/base/address-region.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// Copyright 2018 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_BASE_ADDRESS_REGION_H_
#define V8_BASE_ADDRESS_REGION_H_

#include <iostream>

#include "src/base/macros.h"

namespace v8 {
namespace base {

// Helper class representing an address region of certain size.
class AddressRegion {
public:
// Function object that compares the start address of two regions. Usable as
// compare function on std data structures and algorithms.
struct StartAddressLess {
bool operator()(base::AddressRegion a, base::AddressRegion b) const {
return a.begin() < b.begin();
}
};

using Address = uintptr_t;

constexpr AddressRegion() = default;

constexpr AddressRegion(Address address, size_t size)
: address_(address), size_(size) {}

Address begin() const { return address_; }
Address end() const { return address_ + size_; }

size_t size() const { return size_; }
void set_size(size_t size) { size_ = size; }

bool is_empty() const { return size_ == 0; }

bool contains(Address address) const {
STATIC_ASSERT(std::is_unsigned<Address>::value);
return (address - begin()) < size();
}

bool contains(Address address, size_t size) const {
STATIC_ASSERT(std::is_unsigned<Address>::value);
Address offset = address - begin();
return (offset < size_) && (offset + size <= size_);
}

bool contains(AddressRegion region) const {
return contains(region.address_, region.size_);
}

base::AddressRegion GetOverlap(AddressRegion region) const {
Address overlap_start = std::max(begin(), region.begin());
Address overlap_end =
std::max(overlap_start, std::min(end(), region.end()));
return {overlap_start, overlap_end - overlap_start};
}

bool operator==(AddressRegion other) const {
return address_ == other.address_ && size_ == other.size_;
}

bool operator!=(AddressRegion other) const {
return address_ != other.address_ || size_ != other.size_;
}

private:
Address address_ = 0;
size_t size_ = 0;
};
ASSERT_TRIVIALLY_COPYABLE(AddressRegion);

// Construct an AddressRegion from anything providing a {data()} and {size()}
// accessor.
template <typename Container,
typename = decltype(std::declval<Container>().data()),
typename = decltype(std::declval<Container>().size())>
inline constexpr AddressRegion AddressRegionOf(Container&& c) {
return AddressRegion{reinterpret_cast<AddressRegion::Address>(c.data()),
sizeof(*c.data()) * c.size()};
}

inline std::ostream& operator<<(std::ostream& out, AddressRegion region) {
return out << "[" << reinterpret_cast<void*>(region.begin()) << "+"
<< region.size() << "]";
}

} // namespace base
} // namespace v8

#endif // V8_BASE_ADDRESS_REGION_H_
Loading

0 comments on commit cfc7adf

Please sign in to comment.