0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-21 15:04:33 -05:00
This commit is contained in:
Bert Belder 2019-10-20 16:10:40 -07:00
parent 1e3f137cc2
commit 0e86101ed9
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461
13 changed files with 46 additions and 45 deletions

View file

@ -2,6 +2,7 @@
"C_Cpp.clang_format_style": "Chromium",
"files.associations": {
"memory": "cpp",
"vector": "cpp"
"vector": "cpp",
"cctype": "cpp"
}
}

View file

@ -7,6 +7,7 @@
#include <utility>
#include "../goog/v8/include/v8-inspector.h"
#include "../goog/v8/include/v8.h"
template <class T>
using uninit_t = typename std::aligned_storage<sizeof(T), alignof(T)>::type;
@ -17,6 +18,6 @@ auto launder(T ptr) {
return ptr;
}
#include "v8_inspector/channel.h"
#include "v8_inspector/client.h"
#include "v8_inspector/string_buffer.h"
#include "v8/inspector/channel.h"
#include "v8/inspector/client.h"
#include "v8/string_buffer.h"

View file

@ -1,26 +1,26 @@
#![allow(dead_code)]
#![allow(non_snake_case)]
mod cxx_util;
mod v8_inspector;
mod support;
mod v8;
mod example {
use crate::cxx_util::UniquePtr;
use crate::v8_inspector::channel::*;
use crate::v8_inspector::*;
use crate::support::UniquePtr;
use crate::v8::inspector::channel::*;
use crate::v8::*;
pub struct Example {
a: i32,
channel_extender: ChannelBase,
channel_base: ChannelBase,
b: i32,
}
impl ChannelImpl for Example {
fn base(&self) -> &ChannelBase {
&self.channel_extender
&self.channel_base
}
fn base_mut(&mut self) -> &mut ChannelBase {
&mut self.channel_extender
&mut self.channel_base
}
fn sendResponse(
&mut self,
@ -40,7 +40,7 @@ mod example {
impl Example {
pub fn new() -> Self {
Self {
channel_extender: ChannelBase::new::<Self>(),
channel_base: ChannelBase::new::<Self>(),
a: 2,
b: 3,
}
@ -49,8 +49,8 @@ mod example {
}
fn main() {
use crate::v8_inspector::channel::*;
use crate::v8_inspector::*;
use crate::v8::inspector::channel::*;
use crate::v8::*;
use example::*;
let mut ex = Example::new();
let chan = ex.as_channel_mut();

View file

@ -96,6 +96,7 @@ pub struct FieldOffset<F>(usize, PhantomData<F>);
unsafe impl<F> Send for FieldOffset<F> where F: Send {}
unsafe impl<F> Sync for FieldOffset<F> where F: Sync {}
impl<F> Copy for FieldOffset<F> {}
impl<F> Clone for FieldOffset<F> {

View file

@ -1,11 +1,10 @@
use crate::cxx_util::int;
use crate::cxx_util::CxxVTable;
use crate::cxx_util::FieldOffset;
use crate::cxx_util::Opaque;
use crate::cxx_util::RustVTable;
use crate::cxx_util::UniquePtr;
use super::StringBuffer;
use crate::support::int;
use crate::support::CxxVTable;
use crate::support::FieldOffset;
use crate::support::Opaque;
use crate::support::RustVTable;
use crate::support::UniquePtr;
use crate::v8::StringBuffer;
// class Channel {
// public:

View file

@ -1,8 +1,8 @@
use crate::cxx_util::int;
use crate::cxx_util::CxxVTable;
use crate::cxx_util::FieldOffset;
use crate::cxx_util::Opaque;
use crate::cxx_util::RustVTable;
use crate::support::int;
use crate::support::CxxVTable;
use crate::support::FieldOffset;
use crate::support::Opaque;
use crate::support::RustVTable;
// class V8InspectorClient {
// public:

5
src/v8/inspector/mod.rs Normal file
View file

@ -0,0 +1,5 @@
pub mod channel;
pub mod client;
pub use channel::Channel;
pub use client::Client;

View file

@ -1,9 +1,6 @@
pub mod channel;
pub mod client;
pub mod inspector;
pub mod string_buffer;
pub mod string_view;
pub use channel::Channel;
pub use client::Client;
pub use string_buffer::StringBuffer;
pub use string_view::StringView;

View file

@ -1,10 +1,9 @@
use crate::cxx_util::CxxVTable;
use crate::cxx_util::Delete;
use crate::cxx_util::UniquePtr;
use crate::support::CxxVTable;
use crate::support::Delete;
use crate::support::UniquePtr;
use crate::v8::StringView;
use super::StringView;
// class V8_EXPORT StringBuffer {
// class StringBuffer {
// public:
// virtual ~StringBuffer() = default;
// virtual const StringView& string() = 0;

View file

@ -4,12 +4,6 @@ use std::ptr::null;
use std::ptr::NonNull;
use std::slice;
// Notes:
// * This class is ported, not wrapped using bindings.
// * Since Rust `repr(bool)` is not allowed, assume `bool` and `u8` have the
// same size. TODO: find/open upstream issue to allow #[repr(bool)] support.
// ```cpp
// class StringView {
// public:
// StringView() : m_is8Bit(true), m_length(0), m_characters8(nullptr) {}
@ -34,7 +28,11 @@ use std::slice;
// const uint16_t* m_characters16;
// };
// };
// ```
// Notes:
// * This class is ported, not wrapped using bindings.
// * Since Rust `repr(bool)` is not allowed, assume `bool` and `u8` have the
// same size. TODO: find/open upstream issue to allow #[repr(bool)] support.
#[repr(u8)]
#[derive(Copy, Clone, Debug)]