mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 02:48:12 +08:00
Cleanup
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
use cef::rc::{Rc, RcImpl};
|
||||
use cef::sys::{_cef_browser_process_handler_t, _cef_render_process_handler_t, cef_base_ref_counted_t, cef_browser_process_handler_t, cef_v8_handler_t, cef_v8_propertyattribute_t};
|
||||
use cef::{
|
||||
CefString, ImplBrowserProcessHandler, ImplRenderProcessHandler, ImplV8Context, ImplV8Value, SchemeHandlerFactory, V8Handler, V8Propertyattribute, V8Value, WrapBrowserProcessHandler,
|
||||
WrapRenderProcessHandler, v8_value_create_function,
|
||||
};
|
||||
use cef::sys::{_cef_render_process_handler_t, cef_base_ref_counted_t};
|
||||
use cef::{CefString, ImplRenderProcessHandler, ImplV8Context, ImplV8Value, V8Handler, V8Propertyattribute, WrapRenderProcessHandler, v8_value_create_function};
|
||||
|
||||
use crate::cef::internal::non_browser_v8_handler::NonBrowserV8HandlerImpl;
|
||||
|
||||
@@ -17,7 +14,7 @@ impl NonBrowserRenderProcessHandlerImpl {
|
||||
}
|
||||
|
||||
impl ImplRenderProcessHandler for NonBrowserRenderProcessHandlerImpl {
|
||||
fn on_context_created(&self, browser: Option<&mut cef::Browser>, frame: Option<&mut cef::Frame>, context: Option<&mut cef::V8Context>) {
|
||||
fn on_context_created(&self, _browser: Option<&mut cef::Browser>, _frame: Option<&mut cef::Frame>, context: Option<&mut cef::V8Context>) {
|
||||
let Some(context) = context else {
|
||||
tracing::event!(tracing::Level::ERROR, "No browser in RenderProcessHandlerImpl::on_context_created");
|
||||
return;
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
use cef::{
|
||||
CefString, Frame, ImplFrame, ImplV8Context, ImplV8Handler, ImplV8Value, ProcessId, ProcessMessage, V8Value, WrapV8Handler, process_message_create,
|
||||
rc::Rc,
|
||||
string_userfree_utf16_free,
|
||||
sys::{cef_process_id_t, cef_string_userfree_utf16_free},
|
||||
v8_context_get_current_context,
|
||||
};
|
||||
use tracing::event;
|
||||
use winit::event_loop::EventLoopProxy;
|
||||
use cef::{CefString, ImplFrame, ImplV8Context, ImplV8Handler, ImplV8Value, V8Value, WrapV8Handler, process_message_create, rc::Rc, sys::cef_process_id_t, v8_context_get_current_context};
|
||||
|
||||
pub struct NonBrowserV8HandlerImpl {
|
||||
object: *mut cef::rc::RcImpl<cef::sys::_cef_v8_handler_t, Self>,
|
||||
@@ -28,14 +20,14 @@ impl ImplV8Handler for NonBrowserV8HandlerImpl {
|
||||
_exception: Option<&mut cef::CefString>,
|
||||
) -> ::std::os::raw::c_int {
|
||||
if let Some(name) = name {
|
||||
if name.to_string() == "sendMessageToCef".to_string() {
|
||||
let string = arguments.unwrap().get(0).unwrap().as_ref().unwrap().string_value();
|
||||
if name.to_string() == "sendMessageToCef" {
|
||||
let string = arguments.unwrap().first().unwrap().as_ref().unwrap().string_value();
|
||||
|
||||
let pointer: *mut cef::sys::_cef_string_utf16_t = string.into();
|
||||
let message = unsafe {
|
||||
let str = (*pointer).str_;
|
||||
let len = (*pointer).length;
|
||||
let slice = std::slice::from_raw_parts(str, len as usize);
|
||||
let slice = std::slice::from_raw_parts(str, len);
|
||||
String::from_utf16(slice).unwrap()
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user