mirror of
https://github.com/Drop-OSS/wry-cef.git
synced 2026-01-30 20:55:24 +01:00
refactor: remove redundant clones in WebView and download handling (#1646)
* refactor: remove redundant clones in WebView and download handling * Update .changes/cleanup-redundant-clone.md Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com> --------- Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>
This commit is contained in:
5
.changes/cleanup-redundant-clone.md
Normal file
5
.changes/cleanup-redundant-clone.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"wry": patch
|
||||
---
|
||||
|
||||
Remove redundant clones in WebView and download handling. No user facing changes.
|
||||
@@ -2386,7 +2386,7 @@ impl WebViewExtMacOS for WebView {
|
||||
}
|
||||
|
||||
fn ns_window(&self) -> Retained<NSWindow> {
|
||||
self.webview.webview.window().unwrap().clone()
|
||||
self.webview.webview.window().unwrap()
|
||||
}
|
||||
|
||||
fn reparent(&self, window: *mut NSWindow) -> Result<()> {
|
||||
|
||||
@@ -282,7 +282,7 @@ extern "C" fn start_task(
|
||||
.map_err(|_e| crate::Error::CustomProtocolTaskInvalid)?;
|
||||
|
||||
check_webview_id_valid(webview_id)?;
|
||||
check_task_is_valid(&webview, task_key, task_uuid.clone())?;
|
||||
check_task_is_valid(&webview, task_key, task_uuid)?;
|
||||
|
||||
objc2::exception::catch(AssertUnwindSafe(|| {
|
||||
task.didFinish();
|
||||
|
||||
@@ -74,7 +74,7 @@ pub(crate) fn download_policy(
|
||||
let started_fn = &this.ivars().started;
|
||||
if let Some(started_fn) = started_fn {
|
||||
let mut started_fn = started_fn.borrow_mut();
|
||||
match started_fn(url.to_string().to_string(), &mut download_destination) {
|
||||
match started_fn(url.to_string(), &mut download_destination) {
|
||||
true => {
|
||||
let path = NSString::from_str(&download_destination.display().to_string());
|
||||
let ns_url = NSURL::fileURLWithPath_isDirectory(&path, false);
|
||||
|
||||
@@ -570,7 +570,7 @@ impl InnerWebView {
|
||||
id: webview_id,
|
||||
mtm,
|
||||
webview: webview.clone(),
|
||||
manager: manager.clone(),
|
||||
manager,
|
||||
ns_view: ns_view.retain(),
|
||||
data_store,
|
||||
pending_scripts,
|
||||
@@ -629,7 +629,7 @@ r#"Object.defineProperty(window, 'ipc', {
|
||||
NSAutoresizingMaskOptions::ViewHeightSizable
|
||||
| NSAutoresizingMaskOptions::ViewWidthSizable,
|
||||
);
|
||||
parent_view.addSubview(&webview.clone());
|
||||
parent_view.addSubview(&webview);
|
||||
|
||||
// Tell the webview receive keyboard events in the window.
|
||||
// See https://github.com/tauri-apps/wry/issues/739
|
||||
|
||||
Reference in New Issue
Block a user