| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
chore: enable check raw ptr fields (#38167) | 3 年前 | |
perf: cheaper app string getters, native partial setBounds and postMessage (#54333) * perf: hand back the same V8 string from app.getName(), getVersion() and getAppPath() These built a new V8 string from the same value on every call. Keep the string and return it again until the value changes (setName, setVersion, setAppPath). * fix: accept partial bounds in BaseWindow.setBounds() natively BrowserWindow merged a partial rectangle over getBounds() in a per-instance JavaScript wrapper, which cost a second native call and two objects, and BaseWindow had no wrapper at all, so win.setBounds({ width }) threw there despite being documented. Do the merge in BaseWindow::SetBounds. * perf: post to the main frame without crossing the boundary twice webContents.postMessage() went through the mainFrame accessor and then WebFrameMain.postMessage(). Bind it natively, like send() since #54209. * refactor: move CachedString to shell/common/gin_helper | 30 天前 | |
perf: cheaper app string getters, native partial setBounds and postMessage (#54333) * perf: hand back the same V8 string from app.getName(), getVersion() and getAppPath() These built a new V8 string from the same value on every call. Keep the string and return it again until the value changes (setName, setVersion, setAppPath). * fix: accept partial bounds in BaseWindow.setBounds() natively BrowserWindow merged a partial rectangle over getBounds() in a per-instance JavaScript wrapper, which cost a second native call and two objects, and BaseWindow had no wrapper at all, so win.setBounds({ width }) threw there despite being documented. Do the merge in BaseWindow::SetBounds. * perf: post to the main frame without crossing the boundary twice webContents.postMessage() went through the mainFrame accessor and then WebFrameMain.postMessage(). Bind it natively, like send() since #54209. * refactor: move CachedString to shell/common/gin_helper | 30 天前 | |
chore: bump chromium to 158.0.8107.0 (main) (#55013) * chore: bump chromium in DEPS to 158.0.8106.0 * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> * 8526232: media: Group capture-related fields into CaptureMetadata Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8526232 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8525546: [api] Advance deprecation of callback data APIs Upstream advanced FunctionCallbackInfo::Data() and PropertyCallbackInfo::Data() from V8_DEPRECATE_SOON to V8_DEPRECATED, which Electron builds with -Werror. Switched all call sites to DataV2(), casting through v8::Value where the target type's Cast() only accepts v8::Value. Ref: https://chromium-review.googlesource.com/c/v8/v8/+/8525546 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8577897: Enable DeprecateUnload and DeprecateUnloadByBucket by default. Unload handlers no longer run on http(s) pages unless the page opts in via Permissions-Policy. The detached-frame specs observe IPC sent from an unload handler during cross-origin navigation, so serve their test pages with `Permissions-Policy: unload=*`. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8577897 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * fixup! 8577897: Enable DeprecateUnload and DeprecateUnloadByBucket by default. docs: add breaking change for unload deprecation Document that unload handlers no longer run in http(s) documents, how to migrate to pagehide/visibilitychange, and how to opt back in. Mention pagehide alongside unload in the webFrameMain `frame.detached` docs. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8577897 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * fixup! 8577897: Enable DeprecateUnload and DeprecateUnloadByBucket by default. docs: drop DeprecateUnloadByBucket note from unload breaking change Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * chore: bump chromium in DEPS to 158.0.8107.0 * 8527334: [Linux] Fix GlobalShortcuts portal binding issues Upstream restructured GlobalAcceleratorListenerLinux's bind state machine around the set of IDs to bind and only binds when that set changes. Adapted the registration-resolved patch to it: - ListShortcuts failures no longer abort binding upstream, so they no longer resolve registrations as failed. - Groups in a bind request are collected from the IDs being bound. - Resolve as bound when a version 1 portal already lists every shortcut, and when a group's shortcuts are already bound in the current session (upstream no longer re-binds then). - Keep closing the session on a failed bind so the failed IDs are not recorded as bound in the session. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8527334 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * chore: update patches * 8574624: [Linux] Prevent QT from loading GTK3 when GSettings schemas are invalid The GSettings schema check moved from ui/gtk to ui/base/glib/gsettings.cc, so the warning for the missing font-antialiasing key now reads "Invalid GSettings schema org.gnome.desktop.interface for key font-antialiasing: missing" instead of "Schema org.gnome.desktop.interface does not have key font-antialiasing". Accept either wording in the "creates and refreshes a menu when GTK cannot initialize" spec, since the CL was reverted and relanded. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8574624 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: electron-claude[bot] <279139701+electron-claude[bot]@users.noreply.github.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> | 6 天前 | |
fix: enter JS through a Node callback scope from native callbacks (#54292) * fix: enter JS through a Node callback scope from native callbacks gin_helper::Callback (V8FunctionInvoker), MenuItem::Activate and the Windows notification activation callback called into JS from native code without a node::CallbackScope. Node drains process.nextTick and the microtask queue when the outermost callback scope closes; without one, whatever the callback queued was drained by the next thing that happened to close a scope at depth 1 - for a protocol or webRequest handler that was the first synchronous event emitted by any native call the handler made, so a nextTick ran re-entrantly inside e.g. view.setBounds(). NodeEntryScope opens an InternalCallbackScope only when nothing above it has (callback scope depth 0), so nested entries cost nothing; a genuine top-level entry now drains ticks then microtasks when it returns, like every callback Node itself makes. * fix: enter the callee context first and only engage under kExplicit InternalCallbackScope asserts the environment's context is current; in a renderer with child frames the callback's creation context is not the current one until we enter it. And under Blink's kScoped policy the caller's MicrotasksScope already runs microtasks on exit, so leave the renderer alone and only open the Node scope where Node owns the checkpoint. | 1 个月前 | |
refactor: replace three gin and renderer Chromium patches with existing API (#53904) * refactor: track wrappable teardown in gin_helper::CleanedUpAtExit The weak second-pass callbacks in gin_helper::WrappableBase and DeprecatedWrappableBase must not touch their wrappables once CleanedUpAtExit::DoCleanup() has destroyed them during isolate teardown. That signal was two process-wide bools patched into gin::IsolateHolder, set by JavascriptEnvironment right before DoCleanup() and read only by Electron. Keep it in CleanedUpAtExit itself, set when DoCleanup() starts. Removes feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch. * refactor: load the browser-process V8 snapshot from ElectronMainDelegate With the LoadBrowserProcessSpecificV8Snapshot fuse on, the browser process maps browser_v8_context_snapshot.bin instead of the default snapshot. Content already asks the delegate ShouldLoadV8Snapshot(process_type) before loading, and gin::V8Initializer::LoadV8SnapshotFromFile() takes an already opened file, so ElectronMainDelegate can open the file from the same directory gin uses (the framework bundle on macOS, DIR_ASSETS elsewhere), hand it to gin and tell content not to load its own. That replaces the GetBrowserV8SnapshotFilename() delegate hook and the LoadV8SnapshotFromFileName() gin entry point the patch added. Removes create_browser_v8_snapshot_file_name_fuse.patch. * refactor: carry nodeIntegrationInWorker in a worker content settings client Content already gives the renderer a per-frame object that blink hands to every dedicated worker and off-main-thread worklet a frame creates and Clone()s for nested workers: the WebContentSettingsClient returned from ContentRendererClient::CreateWorkerContentSettingsClient(), readable on the worker thread through WorkerOrWorkletGlobalScope::ContentSettingsClient(). Electron did not implement that hook, so use it to carry the creating frame's nodeIntegrationInWorker decision instead of patching the bit into blink::WorkerSettings and WorkletGlobalScope. Service and shared workers get browser-provided clients and stay excluded as before. Removes feat_plumb_node_integration_in_worker_through_workersettings.patch. | 1 个月前 | |
refactor: replace three gin and renderer Chromium patches with existing API (#53904) * refactor: track wrappable teardown in gin_helper::CleanedUpAtExit The weak second-pass callbacks in gin_helper::WrappableBase and DeprecatedWrappableBase must not touch their wrappables once CleanedUpAtExit::DoCleanup() has destroyed them during isolate teardown. That signal was two process-wide bools patched into gin::IsolateHolder, set by JavascriptEnvironment right before DoCleanup() and read only by Electron. Keep it in CleanedUpAtExit itself, set when DoCleanup() starts. Removes feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch. * refactor: load the browser-process V8 snapshot from ElectronMainDelegate With the LoadBrowserProcessSpecificV8Snapshot fuse on, the browser process maps browser_v8_context_snapshot.bin instead of the default snapshot. Content already asks the delegate ShouldLoadV8Snapshot(process_type) before loading, and gin::V8Initializer::LoadV8SnapshotFromFile() takes an already opened file, so ElectronMainDelegate can open the file from the same directory gin uses (the framework bundle on macOS, DIR_ASSETS elsewhere), hand it to gin and tell content not to load its own. That replaces the GetBrowserV8SnapshotFilename() delegate hook and the LoadV8SnapshotFromFileName() gin entry point the patch added. Removes create_browser_v8_snapshot_file_name_fuse.patch. * refactor: carry nodeIntegrationInWorker in a worker content settings client Content already gives the renderer a per-frame object that blink hands to every dedicated worker and off-main-thread worklet a frame creates and Clone()s for nested workers: the WebContentSettingsClient returned from ContentRendererClient::CreateWorkerContentSettingsClient(), readable on the worker thread through WorkerOrWorkletGlobalScope::ContentSettingsClient(). Electron did not implement that hook, so use it to carry the creating frame's nodeIntegrationInWorker decision instead of patching the bit into blink::WorkerSettings and WorkletGlobalScope. Service and shared workers get browser-provided clients and stay excluded as before. Removes feat_plumb_node_integration_in_worker_through_workersettings.patch. | 1 个月前 | |
refactor: manage gin_helper callbacks with cppgc (#53678) * refactor: manage gin_helper callbacks with cppgc Build gin_helper callback holders on gin::internal::CallbackHolderBase, which wraps a cppgc managed object in v8::CppHeapExternal. This follows https://crrev.com/c/8485746, which is backported here as a Chromium patch until the next roll includes it. Because v8::CppHeapExternal is not a v8::Object, it has no creation context, so a FunctionTemplate or ObjectTemplate that caches a holder no longer retains a discarded context. This removes the need for the per-context template storage. * chore: address review feedback * chore: address review feedback | 17 天前 | |
refactor: give View, BaseWindow, MessagePortMain and ParentPort their prototypes natively (#53962) * refactor: give View, BaseWindow, MessagePortMain and ParentPort their prototypes natively View/WebContentsView/ImageView and BaseWindow/BrowserWindow were plain constructor templates whose prototype chains (EventEmitter, and the subclass -> base links) were stitched together afterwards in lib/ with Object.setPrototypeOf, which is why browser/init.ts had to load web-contents-view.ts before anything could create a window. MessagePort and the utility process's ParentPort were wrapped in JS EventEmitter classes (MessagePortMain, ParentPort) that re-emitted every event and wrapped/unwrapped ports on the way in and out, in the browser, in ipc_dispatch and in the utility bundle. The constructor templates now Inherit() from the EventEmitter template or their base class's template, app gets its EventEmitter prototype when the binding creates it, and MessagePort / ParentPort are Constructible EventEmitters themselves (class names MessagePortMain / ParentPort, not constructible from JavaScript). lib/browser/api/view.ts, web-contents-view.ts, views/image-view.ts, message-port-main.ts and lib/utility/parent-port.ts are deleted along with the port wrapping in message-channel.ts, utility-process.ts, web-frame-main.ts, ipc-dispatch and utility/init.ts. * fix: let process.parentPort.postMessage() be called with no message again --------- Co-authored-by: Claude <noreply@anthropic.com> | 1 个月前 | |
refactor: validate print() and printToPDF() options natively (#53977) * refactor: validate print() and printToPDF() options natively webContents.print()'s pageSize handling, webContents/webFrameMain printToPDF()'s option validation and per-frame-tree job queue (lib/browser/print-to-pdf.ts) and getPrintersAsync() were JavaScript wrappers around _print/_printToPDF/getPrinterListAsync. They are now the native methods themselves: print_to_pdf.cc validates the options and queues jobs per frame tree, WebContents::Print turns pageSize into the media size, and the errors keep their messages and their Error / TypeError / RangeError classes. To keep those messages, option reading goes through two new gin_helper pieces: ConversionError carries why a conversion failed, the property path it failed at and the JavaScript error class to raise, and OptionsReader reads an options object property by property through gin's converters (or a converter that accepts the ConversionError itself), recording the first failure as "<path> must be <type>". * fix: address review findings in native print option handling - print(): validate pageSize before the callback, reject a function as the options object, and only take the no-options fast path when no pageSize was given - printToPDF(): reject instead of throwing for a destroyed WebContents or a disposed WebFrameMain, when reading the options throws, and for BigInt margins; getPrintersAsync() works on a destroyed WebContents again - drop non-finite numbers as the base::Value conversion used to, keep out-of-int-range media sizes as doubles - start PDF jobs from a posted task and refuse frames that are not live * fix: match print() and printToPDF() error classes and ordering in the remaining edge cases - print(): pageSize null throws the TypeError it used to, a function is an unsupported pageSize rather than a custom one - printToPDF(): a WebContents destroyed while its job is queued rejects with a TypeError as before; parameter-range errors are reported before the frame-is-not-live failure * fix: stop reading options after the first failure so later getters do not run * fix: reproduce the margins <= coercion exactly and let a throwing pageSize getter throw out of print() * fix: read a custom pageSize's height before its width, as the JS did * fix: read all four margins before comparing them, as the destructuring did | 1 个月前 | |
refactor: validate print() and printToPDF() options natively (#53977) * refactor: validate print() and printToPDF() options natively webContents.print()'s pageSize handling, webContents/webFrameMain printToPDF()'s option validation and per-frame-tree job queue (lib/browser/print-to-pdf.ts) and getPrintersAsync() were JavaScript wrappers around _print/_printToPDF/getPrinterListAsync. They are now the native methods themselves: print_to_pdf.cc validates the options and queues jobs per frame tree, WebContents::Print turns pageSize into the media size, and the errors keep their messages and their Error / TypeError / RangeError classes. To keep those messages, option reading goes through two new gin_helper pieces: ConversionError carries why a conversion failed, the property path it failed at and the JavaScript error class to raise, and OptionsReader reads an options object property by property through gin's converters (or a converter that accepts the ConversionError itself), recording the first failure as "<path> must be <type>". * fix: address review findings in native print option handling - print(): validate pageSize before the callback, reject a function as the options object, and only take the no-options fast path when no pageSize was given - printToPDF(): reject instead of throwing for a destroyed WebContents or a disposed WebFrameMain, when reading the options throws, and for BigInt margins; getPrintersAsync() works on a destroyed WebContents again - drop non-finite numbers as the base::Value conversion used to, keep out-of-int-range media sizes as doubles - start PDF jobs from a posted task and refuse frames that are not live * fix: match print() and printToPDF() error classes and ordering in the remaining edge cases - print(): pageSize null throws the TypeError it used to, a function is an unsupported pageSize rather than a custom one - printToPDF(): a WebContents destroyed while its job is queued rejects with a TypeError as before; parameter-range errors are reported before the frame-is-not-live failure * fix: stop reading options after the first failure so later getters do not run * fix: reproduce the margins <= coercion exactly and let a throwing pageSize getter throw out of print() * fix: read a custom pageSize's height before its width, as the JS did * fix: read all four margins before comparing them, as the destructuring did | 1 个月前 | |
refactor: add gin_helper and BaseWindow/WebContents helpers for native menus (#53873) - gin_helper::ConvertedValue<T>: a property store for cppgc wrappables that keeps the JS value a script assigned (for identity on read) together with its native conversion, done once at assignment. - gin_helper::Constructible: an optional FillInstanceTemplate() hook for own (instance) properties. - gin_helper::TrackableObject::GetAllNative(): the tracked instances without going through their wrappers. - BaseWindow::GetFocusedWindow() (now also backing BaseWindow.getFocusedWindow()), FromValue(), IsLive(), SetMenuNatively(). - WebContents::GetFocusedWebContents() and session(). | 1 个月前 | |
refactor: remove gin patch to notify microtask runner disposal (#53759) * refactor: remove gin patch to notify microtask runner disposal * fix: invalidate cppgc wrappers before shutdown cleanup Make MicrotasksRunner distinguish between native owned observers and cppgc managed wrappers. This prevents JavaScript callbacks during shutdown from invoking methods on already disposed native objects, regardless of observer registration order. | 1 个月前 | |
refactor: remove gin patch to notify microtask runner disposal (#53759) * refactor: remove gin patch to notify microtask runner disposal * fix: invalidate cppgc wrappers before shutdown cleanup Make MicrotasksRunner distinguish between native owned observers and cppgc managed wrappers. This prevents JavaScript callbacks during shutdown from invoking methods on already disposed native objects, regardless of observer registration order. | 1 个月前 | |
chore: bump chromium to 158.0.8107.0 (main) (#55013) * chore: bump chromium in DEPS to 158.0.8106.0 * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> * 8526232: media: Group capture-related fields into CaptureMetadata Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8526232 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8525546: [api] Advance deprecation of callback data APIs Upstream advanced FunctionCallbackInfo::Data() and PropertyCallbackInfo::Data() from V8_DEPRECATE_SOON to V8_DEPRECATED, which Electron builds with -Werror. Switched all call sites to DataV2(), casting through v8::Value where the target type's Cast() only accepts v8::Value. Ref: https://chromium-review.googlesource.com/c/v8/v8/+/8525546 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8577897: Enable DeprecateUnload and DeprecateUnloadByBucket by default. Unload handlers no longer run on http(s) pages unless the page opts in via Permissions-Policy. The detached-frame specs observe IPC sent from an unload handler during cross-origin navigation, so serve their test pages with `Permissions-Policy: unload=*`. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8577897 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * fixup! 8577897: Enable DeprecateUnload and DeprecateUnloadByBucket by default. docs: add breaking change for unload deprecation Document that unload handlers no longer run in http(s) documents, how to migrate to pagehide/visibilitychange, and how to opt back in. Mention pagehide alongside unload in the webFrameMain `frame.detached` docs. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8577897 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * fixup! 8577897: Enable DeprecateUnload and DeprecateUnloadByBucket by default. docs: drop DeprecateUnloadByBucket note from unload breaking change Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * chore: bump chromium in DEPS to 158.0.8107.0 * 8527334: [Linux] Fix GlobalShortcuts portal binding issues Upstream restructured GlobalAcceleratorListenerLinux's bind state machine around the set of IDs to bind and only binds when that set changes. Adapted the registration-resolved patch to it: - ListShortcuts failures no longer abort binding upstream, so they no longer resolve registrations as failed. - Groups in a bind request are collected from the IDs being bound. - Resolve as bound when a version 1 portal already lists every shortcut, and when a group's shortcuts are already bound in the current session (upstream no longer re-binds then). - Keep closing the session on a failed bind so the failed IDs are not recorded as bound in the session. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8527334 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * chore: update patches * 8574624: [Linux] Prevent QT from loading GTK3 when GSettings schemas are invalid The GSettings schema check moved from ui/gtk to ui/base/glib/gsettings.cc, so the warning for the missing font-antialiasing key now reads "Invalid GSettings schema org.gnome.desktop.interface for key font-antialiasing: missing" instead of "Schema org.gnome.desktop.interface does not have key font-antialiasing". Accept either wording in the "creates and refreshes a menu when GTK cannot initialize" spec, since the CL was reverted and relanded. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8574624 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: electron-claude[bot] <279139701+electron-claude[bot]@users.noreply.github.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> | 6 天前 | |
perf: use plain pointers in stack-only gin_helper types (#54287) refactor: use plain pointers in stack-only gin_helper types gin_helper's Invoker, ErrorThrower, Handle, ObjectBuilder, Promise::SettleScope and the V8 (de)serializer delegates are only ever constructed on the stack, for the duration of one binding call or one conversion. Holding their v8::Isolate / gin::Arguments / wrappable pointers in raw_ptr<> costs a BackupRefPtr acquire and release each time with nothing to protect: mark the types STACK_ALLOCATED() and use plain pointers, matching the upstream gin changes in https://crrev.com/c/8455783 and https://crrev.com/c/8455902. Also take the bound callback by const reference in Invoker::DispatchToCallback, matching https://crrev.com/c/8455325. | 1 个月前 | |
perf: use plain pointers in stack-only gin_helper types (#54287) refactor: use plain pointers in stack-only gin_helper types gin_helper's Invoker, ErrorThrower, Handle, ObjectBuilder, Promise::SettleScope and the V8 (de)serializer delegates are only ever constructed on the stack, for the duration of one binding call or one conversion. Holding their v8::Isolate / gin::Arguments / wrappable pointers in raw_ptr<> costs a BackupRefPtr acquire and release each time with nothing to protect: mark the types STACK_ALLOCATED() and use plain pointers, matching the upstream gin changes in https://crrev.com/c/8455783 and https://crrev.com/c/8455902. Also take the bound callback by const reference in Invoker::DispatchToCallback, matching https://crrev.com/c/8455325. | 1 个月前 | |
refactor: rm chore_add_electron_objects_to_wrappablepointertag.patch (#50957) | 6 个月前 | |
refactor: allocate gin_helper::internal::Event on cpp heap (#48161) | 1 年前 | |
chore: clean up forward declarations (#53106) | 1 个月前 | |
perf: reduce per-call overhead in gin_helper hot paths (#51596) Several gin_helper code paths run on every native event emit, every IPC message, every option-dictionary parse, and every C++ -> JS callback. This change removes a handful of avoidable per-call costs from those paths. EmitEvent / CallMethodWithArgs: - Internalize the event name and the "emit" method name with gin::StringToSymbol so V8 dedupes them against its string table and property lookups can compare by pointer identity instead of hashing a fresh kNormal string on every emit. - Reuse the emitter object as the node::CallbackScope async resource instead of allocating a throwaway v8::Object per emit. - Drop the redundant inner EscapableHandleScope; EmitEvent / CustomEmit already open one immediately around the call. gin_helper::Dictionary: - Internalize property keys via gin::StringToSymbol (matching what gin::DataObjectBuilder and gin::ObjectTemplateBuilder already do). - Replace the unconditional Has() + Get() pair in Get() with a single GetRealNamedProperty() lookup — one V8 boundary crossing per key instead of two, with the same missing-vs-undefined disambiguation. Native interceptor objects (process.env, etc.) are detected with the zero-cost HasNamedLookupInterceptor() hidden-class flag and routed to the Has()/Get() path that drives the interceptor. gin_helper::Locker: - Store v8::Locker inline in std::optional instead of heap-allocating it per construction; this is on the path of every C++ -> JS callback. blink converters: - char16_t::FromV8: read the UTF-16 code unit directly instead of round-tripping V8's internal UTF-16 through UTF-8 and back. Microbenchmark medians (Linux x86-64 testing build): EmitEvent (1 listener) 2806 ns -> 1816 ns (-35%) EmitEvent (no listeners) 2788 ns -> 1800 ns (-35%) Dictionary::Get (per key, all hit) 82.2 ns -> 26.9 ns (-67%) Dictionary::Get (per key, all miss) 55.6 ns -> 18.5 ns (-67%) Dictionary::Set (per key) 121 ns -> 82.6 ns (-32%) gin_helper::Locker ctor/dtor 94.3 ns -> 9.85 ns (-90%) C++ -> JS callback (RepeatingCb) 463 ns -> 301 ns (-35%) | 5 个月前 | |
chore: remove deprecated wrappable support (#53758) * chore: remove deprecated wrappable support api::WebContents was the last user of gin_helper::DeprecatedWrappable and gin_helper::Pinnable, so drop both along with the generic helper overloads and template bookkeeping that only existed to keep the deprecated wrapper info working. The gin patch that restored the deprecated wrapper utilities can go with them, but the gin::PerIsolateData hook that notifies dispose observers before the microtasks runner is disposed is still needed, so reduce the patch to just that hook. * fix: preserve host object serialization Identify V8 API wrappers explicitly when deciding whether an object requires custom serialization instead of relying on its embedder field count. * chore: fix build * fix: cppgc wrappable detection for serialization | 1 个月前 | |
refactor: manage gin_helper callbacks with cppgc (#53678) * refactor: manage gin_helper callbacks with cppgc Build gin_helper callback holders on gin::internal::CallbackHolderBase, which wraps a cppgc managed object in v8::CppHeapExternal. This follows https://crrev.com/c/8485746, which is backported here as a Chromium patch until the next roll includes it. Because v8::CppHeapExternal is not a v8::Object, it has no creation context, so a FunctionTemplate or ObjectTemplate that caches a holder no longer retains a discarded context. This removes the need for the per-context template storage. * chore: address review feedback * chore: address review feedback | 17 天前 | |
refactor: simplify events (#37099) | 3 年前 | |
refactor: manage gin_helper callbacks with cppgc (#53678) * refactor: manage gin_helper callbacks with cppgc Build gin_helper callback holders on gin::internal::CallbackHolderBase, which wraps a cppgc managed object in v8::CppHeapExternal. This follows https://crrev.com/c/8485746, which is backported here as a Chromium patch until the next roll includes it. Because v8::CppHeapExternal is not a v8::Object, it has no creation context, so a FunctionTemplate or ObjectTemplate that caches a holder no longer retains a discarded context. This removes the need for the per-context template storage. * chore: address review feedback * chore: address review feedback | 17 天前 | |
build: enable more performance-* clang-tidy checks (#54024) * build: enable more performance-* clang-tidy checks * chore: performance-prefer-single-char-overloads Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: performance-unnecessary-copy-initialization Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: performance-use-std-move Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: performance-move-const-arg Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: performance-no-automatic-move Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: address review feedback Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MC6nEgyED2MtseZ9KdGMpt * chore: fix new clang-tidy performance findings Address performance-use-std-move, performance-move-const-arg, and performance-prefer-single-char-overloads findings in code that landed on main since the previous base. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MC6nEgyED2MtseZ9KdGMpt * chore: fix new clang-tidy performance findings on macOS Silence performance-unnecessary-copy-initialization for task runners captured by Objective-C blocks in the macOS file and message box dialogs, matching the existing pattern: the copy is needed since a block would otherwise capture the reference by reference. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MC6nEgyED2MtseZ9KdGMpt --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> | 1 天前 | |
refactor: manage gin_helper callbacks with cppgc (#53678) * refactor: manage gin_helper callbacks with cppgc Build gin_helper callback holders on gin::internal::CallbackHolderBase, which wraps a cppgc managed object in v8::CppHeapExternal. This follows https://crrev.com/c/8485746, which is backported here as a Chromium patch until the next roll includes it. Because v8::CppHeapExternal is not a v8::Object, it has no creation context, so a FunctionTemplate or ObjectTemplate that caches a holder no longer retains a discarded context. This removes the need for the per-context template storage. * chore: address review feedback * chore: address review feedback | 17 天前 | |
refactor: manage gin_helper callbacks with cppgc (#53678) * refactor: manage gin_helper callbacks with cppgc Build gin_helper callback holders on gin::internal::CallbackHolderBase, which wraps a cppgc managed object in v8::CppHeapExternal. This follows https://crrev.com/c/8485746, which is backported here as a Chromium patch until the next roll includes it. Because v8::CppHeapExternal is not a v8::Object, it has no creation context, so a FunctionTemplate or ObjectTemplate that caches a holder no longer retains a discarded context. This removes the need for the per-context template storage. * chore: address review feedback * chore: address review feedback | 17 天前 | |
refactor: manage gin_helper callbacks with cppgc (#53678) * refactor: manage gin_helper callbacks with cppgc Build gin_helper callback holders on gin::internal::CallbackHolderBase, which wraps a cppgc managed object in v8::CppHeapExternal. This follows https://crrev.com/c/8485746, which is backported here as a Chromium patch until the next roll includes it. Because v8::CppHeapExternal is not a v8::Object, it has no creation context, so a FunctionTemplate or ObjectTemplate that caches a holder no longer retains a discarded context. This removes the need for the per-context template storage. * chore: address review feedback * chore: address review feedback | 17 天前 | |
chore: remove fix_harden_blink_scriptstate_maybefrom.patch (#53088) * chore: remove fix_harden_blink_scriptstate_maybefrom.patch * chore: update patches * refactor: add embedder index for electron | 2 个月前 | |
perf: use plain pointers in stack-only gin_helper types (#54287) refactor: use plain pointers in stack-only gin_helper types gin_helper's Invoker, ErrorThrower, Handle, ObjectBuilder, Promise::SettleScope and the V8 (de)serializer delegates are only ever constructed on the stack, for the duration of one binding call or one conversion. Holding their v8::Isolate / gin::Arguments / wrappable pointers in raw_ptr<> costs a BackupRefPtr acquire and release each time with nothing to protect: mark the types STACK_ALLOCATED() and use plain pointers, matching the upstream gin changes in https://crrev.com/c/8455783 and https://crrev.com/c/8455902. Also take the bound callback by const reference in Invoker::DispatchToCallback, matching https://crrev.com/c/8455325. | 1 个月前 | |
fix: detach interned string cache before isolate disposal (#54520) Release cached strings and isolate references in OnBeforeDispose rather than after the isolate has been freed. Add a subprocess regression covering clean shutdown after nativeImage.getSize populates the cache. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> | 26 天前 | |
perf: build converted objects with interned keys (#54207) Returning a structure was the most expensive thing the converters did: each field went through Object::Set, a generic store that walks the prototype chain, and each key was internalized from scratch, so V8 hashed it and probed the string table on every call. InternedString caches the key handle per isolate. ObjectBuilder defines the fields as own data properties on a fresh object, so the result has the same shape and prototype an object literal would. The gfx converters (Point, Size, Rect, Insets, Display) use it. Testing build, ns per call: | call | before | after | |----------------------------|-------:|------:| | win.getBounds() | 4197 | 2304 | | screen.getPrimaryDisplay() | 31014 | 12830 | | 1 个月前 | |
perf: reduce per-call overhead in gin_helper hot paths (#51596) Several gin_helper code paths run on every native event emit, every IPC message, every option-dictionary parse, and every C++ -> JS callback. This change removes a handful of avoidable per-call costs from those paths. EmitEvent / CallMethodWithArgs: - Internalize the event name and the "emit" method name with gin::StringToSymbol so V8 dedupes them against its string table and property lookups can compare by pointer identity instead of hashing a fresh kNormal string on every emit. - Reuse the emitter object as the node::CallbackScope async resource instead of allocating a throwaway v8::Object per emit. - Drop the redundant inner EscapableHandleScope; EmitEvent / CustomEmit already open one immediately around the call. gin_helper::Dictionary: - Internalize property keys via gin::StringToSymbol (matching what gin::DataObjectBuilder and gin::ObjectTemplateBuilder already do). - Replace the unconditional Has() + Get() pair in Get() with a single GetRealNamedProperty() lookup — one V8 boundary crossing per key instead of two, with the same missing-vs-undefined disambiguation. Native interceptor objects (process.env, etc.) are detected with the zero-cost HasNamedLookupInterceptor() hidden-class flag and routed to the Has()/Get() path that drives the interceptor. gin_helper::Locker: - Store v8::Locker inline in std::optional instead of heap-allocating it per construction; this is on the path of every C++ -> JS callback. blink converters: - char16_t::FromV8: read the UTF-16 code unit directly instead of round-tripping V8's internal UTF-16 through UTF-8 and back. Microbenchmark medians (Linux x86-64 testing build): EmitEvent (1 listener) 2806 ns -> 1816 ns (-35%) EmitEvent (no listeners) 2788 ns -> 1800 ns (-35%) Dictionary::Get (per key, all hit) 82.2 ns -> 26.9 ns (-67%) Dictionary::Get (per key, all miss) 55.6 ns -> 18.5 ns (-67%) Dictionary::Set (per key) 121 ns -> 82.6 ns (-32%) gin_helper::Locker ctor/dtor 94.3 ns -> 9.85 ns (-90%) C++ -> JS callback (RepeatingCb) 463 ns -> 301 ns (-35%) | 5 个月前 | |
perf: reduce per-call overhead in gin_helper hot paths (#51596) Several gin_helper code paths run on every native event emit, every IPC message, every option-dictionary parse, and every C++ -> JS callback. This change removes a handful of avoidable per-call costs from those paths. EmitEvent / CallMethodWithArgs: - Internalize the event name and the "emit" method name with gin::StringToSymbol so V8 dedupes them against its string table and property lookups can compare by pointer identity instead of hashing a fresh kNormal string on every emit. - Reuse the emitter object as the node::CallbackScope async resource instead of allocating a throwaway v8::Object per emit. - Drop the redundant inner EscapableHandleScope; EmitEvent / CustomEmit already open one immediately around the call. gin_helper::Dictionary: - Internalize property keys via gin::StringToSymbol (matching what gin::DataObjectBuilder and gin::ObjectTemplateBuilder already do). - Replace the unconditional Has() + Get() pair in Get() with a single GetRealNamedProperty() lookup — one V8 boundary crossing per key instead of two, with the same missing-vs-undefined disambiguation. Native interceptor objects (process.env, etc.) are detected with the zero-cost HasNamedLookupInterceptor() hidden-class flag and routed to the Has()/Get() path that drives the interceptor. gin_helper::Locker: - Store v8::Locker inline in std::optional instead of heap-allocating it per construction; this is on the path of every C++ -> JS callback. blink converters: - char16_t::FromV8: read the UTF-16 code unit directly instead of round-tripping V8's internal UTF-16 through UTF-8 and back. Microbenchmark medians (Linux x86-64 testing build): EmitEvent (1 listener) 2806 ns -> 1816 ns (-35%) EmitEvent (no listeners) 2788 ns -> 1800 ns (-35%) Dictionary::Get (per key, all hit) 82.2 ns -> 26.9 ns (-67%) Dictionary::Get (per key, all miss) 55.6 ns -> 18.5 ns (-67%) Dictionary::Set (per key) 121 ns -> 82.6 ns (-32%) gin_helper::Locker ctor/dtor 94.3 ns -> 9.85 ns (-90%) C++ -> JS callback (RepeatingCb) 463 ns -> 301 ns (-35%) | 5 个月前 | |
fix: enter JS through a Node callback scope from native callbacks (#54292) * fix: enter JS through a Node callback scope from native callbacks gin_helper::Callback (V8FunctionInvoker), MenuItem::Activate and the Windows notification activation callback called into JS from native code without a node::CallbackScope. Node drains process.nextTick and the microtask queue when the outermost callback scope closes; without one, whatever the callback queued was drained by the next thing that happened to close a scope at depth 1 - for a protocol or webRequest handler that was the first synchronous event emitted by any native call the handler made, so a nextTick ran re-entrantly inside e.g. view.setBounds(). NodeEntryScope opens an InternalCallbackScope only when nothing above it has (callback scope depth 0), so nested entries cost nothing; a genuine top-level entry now drains ticks then microtasks when it returns, like every callback Node itself makes. * fix: enter the callee context first and only engage under kExplicit InternalCallbackScope asserts the environment's context is current; in a renderer with child frames the callback's creation context is not the current one until we enter it. And under Blink's kScoped policy the caller's MicrotasksScope already runs microtasks on exit, so leave the renderer alone and only open the Node scope where Node owns the checkpoint. | 1 个月前 | |
fix: enter JS through a Node callback scope from native callbacks (#54292) * fix: enter JS through a Node callback scope from native callbacks gin_helper::Callback (V8FunctionInvoker), MenuItem::Activate and the Windows notification activation callback called into JS from native code without a node::CallbackScope. Node drains process.nextTick and the microtask queue when the outermost callback scope closes; without one, whatever the callback queued was drained by the next thing that happened to close a scope at depth 1 - for a protocol or webRequest handler that was the first synchronous event emitted by any native call the handler made, so a nextTick ran re-entrantly inside e.g. view.setBounds(). NodeEntryScope opens an InternalCallbackScope only when nothing above it has (callback scope depth 0), so nested entries cost nothing; a genuine top-level entry now drains ticks then microtasks when it returns, like every callback Node itself makes. * fix: enter the callee context first and only engage under kExplicit InternalCallbackScope asserts the environment's context is current; in a renderer with child frames the callback's creation context is not the current one until we enter it. And under Blink's kScoped policy the caller's MicrotasksScope already runs microtasks on exit, so leave the renderer alone and only open the Node scope where Node owns the checkpoint. | 1 个月前 | |
chore: bump chromium to 158.0.8107.0 (main) (#55013) * chore: bump chromium in DEPS to 158.0.8106.0 * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> * 8526232: media: Group capture-related fields into CaptureMetadata Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8526232 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8525546: [api] Advance deprecation of callback data APIs Upstream advanced FunctionCallbackInfo::Data() and PropertyCallbackInfo::Data() from V8_DEPRECATE_SOON to V8_DEPRECATED, which Electron builds with -Werror. Switched all call sites to DataV2(), casting through v8::Value where the target type's Cast() only accepts v8::Value. Ref: https://chromium-review.googlesource.com/c/v8/v8/+/8525546 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8577897: Enable DeprecateUnload and DeprecateUnloadByBucket by default. Unload handlers no longer run on http(s) pages unless the page opts in via Permissions-Policy. The detached-frame specs observe IPC sent from an unload handler during cross-origin navigation, so serve their test pages with `Permissions-Policy: unload=*`. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8577897 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * fixup! 8577897: Enable DeprecateUnload and DeprecateUnloadByBucket by default. docs: add breaking change for unload deprecation Document that unload handlers no longer run in http(s) documents, how to migrate to pagehide/visibilitychange, and how to opt back in. Mention pagehide alongside unload in the webFrameMain `frame.detached` docs. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8577897 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * fixup! 8577897: Enable DeprecateUnload and DeprecateUnloadByBucket by default. docs: drop DeprecateUnloadByBucket note from unload breaking change Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * chore: bump chromium in DEPS to 158.0.8107.0 * 8527334: [Linux] Fix GlobalShortcuts portal binding issues Upstream restructured GlobalAcceleratorListenerLinux's bind state machine around the set of IDs to bind and only binds when that set changes. Adapted the registration-resolved patch to it: - ListShortcuts failures no longer abort binding upstream, so they no longer resolve registrations as failed. - Groups in a bind request are collected from the IDs being bound. - Resolve as bound when a version 1 portal already lists every shortcut, and when a group's shortcuts are already bound in the current session (upstream no longer re-binds then). - Keep closing the session on a failed bind so the failed IDs are not recorded as bound in the session. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8527334 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * chore: update patches * 8574624: [Linux] Prevent QT from loading GTK3 when GSettings schemas are invalid The GSettings schema check moved from ui/gtk to ui/base/glib/gsettings.cc, so the warning for the missing font-antialiasing key now reads "Invalid GSettings schema org.gnome.desktop.interface for key font-antialiasing: missing" instead of "Schema org.gnome.desktop.interface does not have key font-antialiasing". Accept either wording in the "creates and refreshes a menu when GTK cannot initialize" spec, since the CL was reverted and relanded. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8574624 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: electron-claude[bot] <279139701+electron-claude[bot]@users.noreply.github.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> | 6 天前 | |
refactor: provide the renderer API modules from their bindings (#53973) * refactor: create ipcRenderer natively `ipcRenderer` and the internal `ipcRendererInternal` were JavaScript classes extending EventEmitter that forwarded to an `electron_renderer_ipc` binding object, and a start-up module registered them as the targets for incoming messages. The binding now builds both objects itself when it is loaded into a context: instances of the shared native EventEmitter class with `send`/`sendSync`/`invoke`/`postMessage`/`sendToHost` implemented in C++ on an intermediate prototype (so, as before, they are not own properties and work unbound), and it registers them for incoming messages. The TypeScript modules re-export the binding's objects. gin_helper::GetNodeEventEmitterConstructor() caches one EventEmitter class per context so that these objects and the class exposed to scripts share a prototype. * refactor: create contextBridge natively The `contextBridge` module was a JavaScript wrapper that checked `process.contextIsolated` and forwarded to the `electron_renderer_context_bridge` binding. The binding now exports the module object directly, doing the context isolation check in C++ (the frame's web preference, or always allowed in a service worker preload realm), and in debug builds attaches the `internalContextBridge` helpers the tests use. * refactor: make webFrame an EventEmitter natively The `webFrame` module wrapped the `electron_renderer_web_frame` binding in JavaScript to make `WebFrame` an EventEmitter, to start emitting 'isolated-world-created' when something first listens for it, and to implement the deprecated `routingId` / `findFrameByRoutingId()` with a synchronous internal IPC to the browser. The binding now chains `WebFrame.prototype` to the context's native EventEmitter, hooks `on()` and friends for the lazy 'isolated-world-created' registration, and implements the two deprecated members over a sync call on ElectronWebContentsUtility, so the browser-side IPC handlers go away. The renderer `crashReporter` module likewise re-exports its binding. * refactor: receive transferred shared textures in the renderer natively `sharedTexture.sendSharedTexture()` reached the target frame through an internal IPC round trip answered by the renderer-side `sharedTexture` module, which imported the texture, replied with its sync token and called the receiver registered with `setSharedTextureReceiver()`. That now happens over mojom::ElectronFrame::ReceiveSharedTexture(), implemented by ElectronApiServiceImpl: it imports the texture with the `electron_common_shared_texture` binding in the frame's Electron context, replies with the frame creation sync token (or the error), and invokes the registered receiver with the same `{ importedSharedTexture }` object as before. The receiver is registered natively by the binding, so the renderer module is a plain re-export and the last `invokeInWebFrameMain` helper is removed. * fix: address review comments on the native renderer API modules - Import a transferred shared texture by calling shared_texture::FinishTransferSharedTexture() directly rather than going through the binding's exports object. - WebFrame's listener hooks carry the EventEmitter.prototype method they defer to as callback data instead of looking it up on every call. | 1 个月前 | |
perf: build converted objects with interned keys (#54207) Returning a structure was the most expensive thing the converters did: each field went through Object::Set, a generic store that walks the prototype chain, and each key was internalized from scratch, so V8 hashed it and probed the string table on every call. InternedString caches the key handle per isolate. ObjectBuilder defines the fields as own data properties on a fresh object, so the result has the same shape and prototype an object literal would. The gfx converters (Point, Size, Rect, Insets, Display) use it. Testing build, ns per call: | call | before | after | |----------------------------|-------:|------:| | win.getBounds() | 4197 | 2304 | | screen.getPrimaryDisplay() | 31014 | 12830 | | 1 个月前 | |
perf: use plain pointers in stack-only gin_helper types (#54287) refactor: use plain pointers in stack-only gin_helper types gin_helper's Invoker, ErrorThrower, Handle, ObjectBuilder, Promise::SettleScope and the V8 (de)serializer delegates are only ever constructed on the stack, for the duration of one binding call or one conversion. Holding their v8::Isolate / gin::Arguments / wrappable pointers in raw_ptr<> costs a BackupRefPtr acquire and release each time with nothing to protect: mark the types STACK_ALLOCATED() and use plain pointers, matching the upstream gin changes in https://crrev.com/c/8455783 and https://crrev.com/c/8455902. Also take the bound callback by const reference in Invoker::DispatchToCallback, matching https://crrev.com/c/8455325. | 1 个月前 | |
chore: migrate base::StringPiece to std::string_view (#40915) * chore: migrate from base::StringPiece to std::string_view in keyboard_util.cc * chore: migrate from base::StringPiece to std::string_view in error_thrower.cc * chore: migrate from base::StringPiece to std::string_view in electron_api_web_contents.cc * chore: migrate from base::StringPiece to std::string_view in gin_helper/dictionary.h * chore: migrate from base::StringPiece to std::string_view in electron_api_url_loader.cc * chore: phase out internal use of base:::StringPiece `base::StringPiece` is being phased out upstream. Its code has been removed upstream and it's just a typedef for `std::string_view`. They haven't removed the typedef yet, so this PR tries to get ahead of future breakage by migrating "internal" use (i.e. leaving alone the places where the `base::StringPiece` name is coming from an upstream method that we override). Xref: https://bugs.chromium.org/p/chromium/issues/detail?id=691162 Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4294483 Xref: https://docs.google.com/document/d/1d4RnD1uAE2t4iANR0nXy82ASIPGsPuw2mpO6v6T7JKs | 2 年前 | |
perf: dispatch gin_helper-bound methods without a callback object or a per-call liveness probe (#54331) * perf: dispatch gin_helper-bound methods and accessors to a target named at compile time CreateFunctionTemplate stores a base::RepeatingCallback in a heap-allocated holder, hands V8 an External pointing at it, and on every call unwraps the External, runs the callback through two indirect calls and holds a reference on its bind state for the duration. For a plain function or member function none of that is needed: SetMethod<&T::Method>(name) and SetProperty<&T::Getter[, &T::Setter]>(name) instantiate a V8 callback that calls the target directly, with the same argument conversion, destroyed check, microtasks scope and error messages as before. Converts every call site on gin_helper::ObjectTemplateBuilder and gin_helper::Dictionary whose target is a plain function or member function. Classes built through gin::ObjectTemplateBuilder keep the callback path until gin grows the same overload upstream. * perf: only ask whether the receiver is destroyed once it has failed to convert Every bound call checked Destroyable::IsDestroyed on the holder before converting it, and for cppgc wrappers that check cannot short-circuit on an internal field, so it unwrapped the object through a TLS isolate lookup on every call. The check never guards the call itself: a destroyed gin_helper wrapper has a null internal field and an inert cppgc wrapper unwraps to null, so both already fail the receiver conversion and throw. All it decides is whether the error says 'Object has been destroyed' or 'Illegal invocation'. Make that decision in ThrowConversionError, after the conversion has failed, so a successful call pays nothing for it. This relies on every receiver converter on main being null-safe, which has held since the deprecated wrappable path was removed in #53758. * refactor: share the direct dispatcher's conversion code per signature Split the compile-time dispatcher the way the gin change does it: SignatureDispatcher<Target> converts the arguments (receiver included, as the first argument, for a member function) and calls through a Target passed at run time, and DirectDispatcher<kTarget> is the V8 callback, a thunk that hands it kTarget. Targets of the same signature share one converter; the receiver goes through the same ArgumentHolder path as the callback form, so there is one place that decides the error message. CreateDirectFunctionTemplate<kTarget> becomes an overload of CreateFunctionTemplate<kTarget>, matching gin. | 30 天前 | |
refactor: validate print() and printToPDF() options natively (#53977) * refactor: validate print() and printToPDF() options natively webContents.print()'s pageSize handling, webContents/webFrameMain printToPDF()'s option validation and per-frame-tree job queue (lib/browser/print-to-pdf.ts) and getPrintersAsync() were JavaScript wrappers around _print/_printToPDF/getPrinterListAsync. They are now the native methods themselves: print_to_pdf.cc validates the options and queues jobs per frame tree, WebContents::Print turns pageSize into the media size, and the errors keep their messages and their Error / TypeError / RangeError classes. To keep those messages, option reading goes through two new gin_helper pieces: ConversionError carries why a conversion failed, the property path it failed at and the JavaScript error class to raise, and OptionsReader reads an options object property by property through gin's converters (or a converter that accepts the ConversionError itself), recording the first failure as "<path> must be <type>". * fix: address review findings in native print option handling - print(): validate pageSize before the callback, reject a function as the options object, and only take the no-options fast path when no pageSize was given - printToPDF(): reject instead of throwing for a destroyed WebContents or a disposed WebFrameMain, when reading the options throws, and for BigInt margins; getPrintersAsync() works on a destroyed WebContents again - drop non-finite numbers as the base::Value conversion used to, keep out-of-int-range media sizes as doubles - start PDF jobs from a posted task and refuse frames that are not live * fix: match print() and printToPDF() error classes and ordering in the remaining edge cases - print(): pageSize null throws the TypeError it used to, a function is an unsupported pageSize rather than a custom one - printToPDF(): a WebContents destroyed while its job is queued rejects with a TypeError as before; parameter-range errors are reported before the frame-is-not-live failure * fix: stop reading options after the first failure so later getters do not run * fix: reproduce the margins <= coercion exactly and let a throwing pageSize getter throw out of print() * fix: read a custom pageSize's height before its width, as the JS did * fix: read all four margins before comparing them, as the destructuring did | 1 个月前 | |
refactor: validate print() and printToPDF() options natively (#53977) * refactor: validate print() and printToPDF() options natively webContents.print()'s pageSize handling, webContents/webFrameMain printToPDF()'s option validation and per-frame-tree job queue (lib/browser/print-to-pdf.ts) and getPrintersAsync() were JavaScript wrappers around _print/_printToPDF/getPrinterListAsync. They are now the native methods themselves: print_to_pdf.cc validates the options and queues jobs per frame tree, WebContents::Print turns pageSize into the media size, and the errors keep their messages and their Error / TypeError / RangeError classes. To keep those messages, option reading goes through two new gin_helper pieces: ConversionError carries why a conversion failed, the property path it failed at and the JavaScript error class to raise, and OptionsReader reads an options object property by property through gin's converters (or a converter that accepts the ConversionError itself), recording the first failure as "<path> must be <type>". * fix: address review findings in native print option handling - print(): validate pageSize before the callback, reject a function as the options object, and only take the no-options fast path when no pageSize was given - printToPDF(): reject instead of throwing for a destroyed WebContents or a disposed WebFrameMain, when reading the options throws, and for BigInt margins; getPrintersAsync() works on a destroyed WebContents again - drop non-finite numbers as the base::Value conversion used to, keep out-of-int-range media sizes as doubles - start PDF jobs from a posted task and refuse frames that are not live * fix: match print() and printToPDF() error classes and ordering in the remaining edge cases - print(): pageSize null throws the TypeError it used to, a function is an unsupported pageSize rather than a custom one - printToPDF(): a WebContents destroyed while its job is queued rejects with a TypeError as before; parameter-range errors are reported before the frame-is-not-live failure * fix: stop reading options after the first failure so later getters do not run * fix: reproduce the margins <= coercion exactly and let a throwing pageSize getter throw out of print() * fix: read a custom pageSize's height before its width, as the JS did * fix: read all four margins before comparing them, as the destructuring did | 1 个月前 | |
chore: remove native_mate (Part 12) (#20869) * refactor: move mate::Event to gin * refactor: move mate::Locker to gin * refactor: convert contextBridge to gin * refactor: convert contentTracing to gin * refactor: remove callback converter of native_mate * refactor: remove file_dialog_converter and native_window_converter from native_mate * refactor: convert webFrame to gin * refactor: move blink_converter to gin * refactor: remove net_converter from native_mate * refactor: remove event_emitter_caller_deprecated * refactor: remove gurl_converter from native_mate * refactor: remove file_path and string16_converter from native_mate * refactor: remove image_converter from native_mate * refactor: move value_converter to gin | 6 年前 | |
refactor: use `gin_helper::Dictionary::ValueOrDefault()` (#46982) * refactor: use ValueOrDefault() in electron_api_web_contents.cc * refactor: use ValueOrDefault() in electron_api_url_loader.cc * refactor: use ValueOrDefault() in electron_download_manager_delegate.cc * refactor: use ValueOrDefault() in electron_touch_bar.mm * refactor: use ValueOrDefault() in electron_url_loader_factory.cc * refactor: use ValueOrDefault() in electron_browser_context.cc * refactor: use ValueOrDefault() in electron_touch_bar.mm * refactor: use ValueOrDefault() in blink_converter.cc * feat: add ValueOrDefault() to PersistentDictionary * empty commit * refactor: use ValueOrDefault() in blink_converter.cc * refactor: inline the rectangle base::Value::Dict * refactor: remove has_scroll temporary --------- Co-authored-by: Deepak Mohan <hop2deep@gmail.com> | 1 年前 | |
build: enable dangling raw_ptr checks (#54619) * fix: clear vibrancy view before destruction Keep the removed NativeViewHost alive until vibrant_native_view_host_ has been cleared. Memory was freed at: 0 Electron Framework 0x000000012b8e4940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012b8cfa00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x000000012b8ea86c base::allocator::(anonymous namespace)::DanglingRawPtrDetected(unsigned long) + 764 3 Electron Framework 0x000000012b996bcc void partition_alloc::PartitionRoot::FreeInline<(partition_alloc::internal::FreeFlags)8>(void*) + 5392 4 Electron Framework 0x00000001335fe8f4 views::NativeViewHost::~NativeViewHost() + 16 5 Electron Framework 0x0000000124916004 ___ZN8electron15NativeWindowMac11SetVibrancyERKNSt4__Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEi_block_invoke + 140 6 Electron Framework 0x0000000124915a74 electron::NativeWindowMac::SetVibrancy(std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>> const&, int) + 1048 The dangling raw_ptr was released at: 0 Electron Framework 0x000000012b8e4940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012b8cfa00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x000000012b8eb158 void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)1, (base::features::DanglingPtrType)0>(unsigned long) + 92 3 Electron Framework 0x000000012b93c3b4 base::internal::RawPtrBackupRefImpl<false>::ReleaseInternal(unsigned long) + 480 4 Electron Framework 0x0000000124916058 ___ZN8electron15NativeWindowMac11SetVibrancyERKNSt4__Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEi_block_invoke + 224 5 Electron Framework 0x0000000124915a74 electron::NativeWindowMac::SetVibrancy(std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>> const&, int) + 1048 * fix: clear notification delegate before callback Release delegate_ before NotificationDestroyed() can synchronously delete the delegate. Memory was freed at: 0 Electron Framework 0x000000012b8e4940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012b8cfa00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x000000012b8ea86c base::allocator::(anonymous namespace)::DanglingRawPtrDetected(unsigned long) + 764 3 Electron Framework 0x000000012b9aa080 void partition_alloc::PartitionRoot::FreeInline<(partition_alloc::internal::FreeFlags)22>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)22)>::Type) + 5928 4 Electron Framework 0x000000012b99f940 void partition_alloc::PartitionRoot::FreeInUnknownRoot<(partition_alloc::internal::FreeFlags)22>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)22)>::Type) + 1324 5 Electron Framework 0x000000012b9c3a50 allocator_shim::internal::PartitionAllocFunctionsInternal<(partition_alloc::internal::AllocFlags)16, (partition_alloc::internal::FreeFlags)6>::FreeWithSize(void*, unsigned long, void*) + 200 6 Electron Framework 0x00000001247f797c electron::Notification::~Notification() + 72 7 Electron Framework 0x0000000124919fbc electron::CocoaNotification::~CocoaNotification() + 220 8 Electron Framework 0x000000012491a014 electron::CocoaNotification::~CocoaNotification() + 12 9 Electron Framework 0x00000001247f81cc electron::NotificationPresenter::RemoveNotification(electron::Notification*) + 200 The dangling raw_ptr was released at: 0 Electron Framework 0x000000012b8e4940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012b8cfa00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x000000012b8eb158 void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)1, (base::features::DanglingPtrType)0>(unsigned long) + 92 3 Electron Framework 0x000000012b93c3b4 base::internal::RawPtrBackupRefImpl<false>::ReleaseInternal(unsigned long) + 480 4 Electron Framework 0x00000001247f7a50 electron::Notification::~Notification() + 284 5 Electron Framework 0x0000000124919fbc electron::CocoaNotification::~CocoaNotification() + 220 6 Electron Framework 0x000000012491a014 electron::CocoaNotification::~CocoaNotification() + 12 7 Electron Framework 0x00000001247f81cc electron::NotificationPresenter::RemoveNotification(electron::Notification*) + 200 * fix: erase notifications before destruction Remove each raw_ptr from notifications_ before deleting the Notification it references. Memory was freed at: 0 Electron Framework 0x000000012cacd6e0 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012cab6968 base::debug::StackTrace::StackTrace(unsigned long) + 168 2 Electron Framework 0x000000012cad3a24 base::allocator::(anonymous namespace)::DanglingRawPtrDetected(unsigned long) + 764 3 Electron Framework 0x000000012cbbb9ac void partition_alloc::PartitionRoot::FreeInline<(partition_alloc::internal::FreeFlags)22>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)22)>::Type) + 5868 4 Electron Framework 0x000000012cbb1264 void partition_alloc::PartitionRoot::FreeInUnknownRoot<(partition_alloc::internal::FreeFlags)22>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)22)>::Type) + 1324 5 Electron Framework 0x000000012cbd522c allocator_shim::internal::PartitionAllocFunctionsInternal<(partition_alloc::internal::AllocFlags)16, (partition_alloc::internal::FreeFlags)6>::FreeWithSize(void*, unsigned long, void*) + 200 6 Electron Framework 0x00000001258ed394 electron::NotificationPresenter::~NotificationPresenter() + 72 7 Electron Framework 0x0000000125a0ee60 electron::NotificationPresenterMac::~NotificationPresenterMac() + 356 8 Electron Framework 0x0000000125a0ef00 electron::NotificationPresenterMac::~NotificationPresenterMac() + 12 9 Electron Framework 0x0000000125868dfc electron::ElectronBrowserClient::~ElectronBrowserClient() + 500 The dangling raw_ptr was released at: 0 Electron Framework 0x000000012cacd6e0 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012cab6968 base::debug::StackTrace::StackTrace(unsigned long) + 168 2 Electron Framework 0x000000012cad3aec void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)0, (base::features::DanglingPtrType)0>(unsigned long) + 84 3 Electron Framework 0x000000012cb27fc8 base::internal::RawPtrBackupRefImpl<false>::ReleaseInternal(unsigned long) + 480 4 Electron Framework 0x00000001258b87c8 void std::__Cr::__destroy_at[abi:sqn240000]<base::raw_ptr<DraggableRegionProvider, (partition_alloc::internal::RawPtrTraits)0>>(base::raw_ptr<DraggableRegionProvider, (partition_alloc::internal::RawPtrTraits)0>*) + 136 5 Electron Framework 0x00000001258eda14 std::__Cr::__tree<base::raw_ptr<electron::Notification, (partition_alloc::internal::RawPtrTraits)0>, std::__Cr::less<base::raw_ptr<electron::Notification, (partition_alloc::internal::RawPtrTraits)0>>, std::__Cr::allocator<base::raw_ptr<electron::Notification, (partition_alloc::internal::RawPtrTraits)0>>>::__tree_deleter::operator()[abi:sqn240000](std::__Cr::__tree_node<base::raw_ptr<electron::Notification, (partition_alloc::internal::RawPtrTraits)0>, void*>*) + 52 6 Electron Framework 0x00000001258ed3d4 electron::NotificationPresenter::~NotificationPresenter() + 136 7 Electron Framework 0x0000000125a0ee60 electron::NotificationPresenterMac::~NotificationPresenterMac() + 356 8 Electron Framework 0x0000000125a0ef00 electron::NotificationPresenterMac::~NotificationPresenterMac() + 12 9 Electron Framework 0x0000000125868dfc electron::ElectronBrowserClient::~ElectronBrowserClient() + 500 * fix: clear Node environment before teardown Clear NodeBindings::uv_env_ before NodeService releases the node::Environment. Memory was freed at: 0 Electron Framework 0x0000000129b78940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x0000000129b63a00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x0000000129b7e86c base::allocator::(anonymous namespace)::DanglingRawPtrDetected(unsigned long) + 764 3 Electron Framework 0x0000000129c3c93c void partition_alloc::PartitionRoot::FreeInline<(partition_alloc::internal::FreeFlags)18>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)18)>::Type) + 8480 4 Electron Framework 0x0000000129c33390 void partition_alloc::PartitionRoot::FreeInUnknownRoot<(partition_alloc::internal::FreeFlags)18>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)18)>::Type) + 1324 5 Electron Framework 0x0000000129c56ce8 allocator_shim::internal::PartitionAllocFunctionsInternal<(partition_alloc::internal::AllocFlags)16, (partition_alloc::internal::FreeFlags)2>::FreeWithSize(void*, unsigned long, void*) + 200 6 Electron Framework 0x0000000122c4bd24 node::FreeEnvironment(node::Environment*) + 248 7 Electron Framework 0x0000000122b3a74c _ZNSt4__Cr20__shared_ptr_pointerB9sqn240000IPN4node11EnvironmentEZN8electron12NodeBindings17CreateEnvironmentEPN2v87IsolateENS6_5LocalINS6_7ContextEEEPNS1_20MultiIsolatePlatformEmNS_6vectorINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENSI_ISK_EEEESM_NS_8optionalIN4base17RepeatingCallbackIFvvEEEEEE3$_0NSI_IS2_EEE16__on_zero_sharedEv + 188 8 Electron Framework 0x0000000122b7ee40 electron::NodeService::~NodeService() + 416 9 Electron Framework 0x0000000122b7ef2c electron::NodeService::~NodeService() + 12 The dangling raw_ptr was released at: 0 Electron Framework 0x0000000129b78940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x0000000129b63a00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x0000000129b7e934 void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)0, (base::features::DanglingPtrType)0>(unsigned long) + 84 3 Electron Framework 0x0000000129bd03b4 base::internal::RawPtrBackupRefImpl<false>::ReleaseInternal(unsigned long) + 480 4 Electron Framework 0x0000000122b34b94 electron::NodeBindings::~NodeBindings() + 372 5 Electron Framework 0x0000000122bde08c electron::NodeBindingsMac::~NodeBindingsMac() + 12 6 Electron Framework 0x0000000122b7edf8 electron::NodeService::~NodeService() + 344 7 Electron Framework 0x0000000122b7ef2c electron::NodeService::~NodeService() + 12 * fix: enable dangling raw_ptr checks * fix: avoid retaining isolate in PromiseBase Resolve PromiseHandle traced references with the currently entered isolate instead of retaining a raw pointer that can outlive IsolateHolder. Promise operations already require execution on their creation thread with the isolate entered. ``` gin::IsolateHolder::~IsolateHolder -> JavascriptEnvironment::~JavascriptEnvironment -> isolate free static Promise<void> destruction -> PromiseBase::~PromiseBase -> isolate_ raw_ptr release ``` * fix: annotate additional dangling raw pointers * fix(win): annotate additional dangling raw_ptr | 21 天前 | |
build: enable dangling raw_ptr checks (#54619) * fix: clear vibrancy view before destruction Keep the removed NativeViewHost alive until vibrant_native_view_host_ has been cleared. Memory was freed at: 0 Electron Framework 0x000000012b8e4940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012b8cfa00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x000000012b8ea86c base::allocator::(anonymous namespace)::DanglingRawPtrDetected(unsigned long) + 764 3 Electron Framework 0x000000012b996bcc void partition_alloc::PartitionRoot::FreeInline<(partition_alloc::internal::FreeFlags)8>(void*) + 5392 4 Electron Framework 0x00000001335fe8f4 views::NativeViewHost::~NativeViewHost() + 16 5 Electron Framework 0x0000000124916004 ___ZN8electron15NativeWindowMac11SetVibrancyERKNSt4__Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEi_block_invoke + 140 6 Electron Framework 0x0000000124915a74 electron::NativeWindowMac::SetVibrancy(std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>> const&, int) + 1048 The dangling raw_ptr was released at: 0 Electron Framework 0x000000012b8e4940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012b8cfa00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x000000012b8eb158 void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)1, (base::features::DanglingPtrType)0>(unsigned long) + 92 3 Electron Framework 0x000000012b93c3b4 base::internal::RawPtrBackupRefImpl<false>::ReleaseInternal(unsigned long) + 480 4 Electron Framework 0x0000000124916058 ___ZN8electron15NativeWindowMac11SetVibrancyERKNSt4__Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEi_block_invoke + 224 5 Electron Framework 0x0000000124915a74 electron::NativeWindowMac::SetVibrancy(std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>> const&, int) + 1048 * fix: clear notification delegate before callback Release delegate_ before NotificationDestroyed() can synchronously delete the delegate. Memory was freed at: 0 Electron Framework 0x000000012b8e4940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012b8cfa00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x000000012b8ea86c base::allocator::(anonymous namespace)::DanglingRawPtrDetected(unsigned long) + 764 3 Electron Framework 0x000000012b9aa080 void partition_alloc::PartitionRoot::FreeInline<(partition_alloc::internal::FreeFlags)22>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)22)>::Type) + 5928 4 Electron Framework 0x000000012b99f940 void partition_alloc::PartitionRoot::FreeInUnknownRoot<(partition_alloc::internal::FreeFlags)22>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)22)>::Type) + 1324 5 Electron Framework 0x000000012b9c3a50 allocator_shim::internal::PartitionAllocFunctionsInternal<(partition_alloc::internal::AllocFlags)16, (partition_alloc::internal::FreeFlags)6>::FreeWithSize(void*, unsigned long, void*) + 200 6 Electron Framework 0x00000001247f797c electron::Notification::~Notification() + 72 7 Electron Framework 0x0000000124919fbc electron::CocoaNotification::~CocoaNotification() + 220 8 Electron Framework 0x000000012491a014 electron::CocoaNotification::~CocoaNotification() + 12 9 Electron Framework 0x00000001247f81cc electron::NotificationPresenter::RemoveNotification(electron::Notification*) + 200 The dangling raw_ptr was released at: 0 Electron Framework 0x000000012b8e4940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012b8cfa00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x000000012b8eb158 void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)1, (base::features::DanglingPtrType)0>(unsigned long) + 92 3 Electron Framework 0x000000012b93c3b4 base::internal::RawPtrBackupRefImpl<false>::ReleaseInternal(unsigned long) + 480 4 Electron Framework 0x00000001247f7a50 electron::Notification::~Notification() + 284 5 Electron Framework 0x0000000124919fbc electron::CocoaNotification::~CocoaNotification() + 220 6 Electron Framework 0x000000012491a014 electron::CocoaNotification::~CocoaNotification() + 12 7 Electron Framework 0x00000001247f81cc electron::NotificationPresenter::RemoveNotification(electron::Notification*) + 200 * fix: erase notifications before destruction Remove each raw_ptr from notifications_ before deleting the Notification it references. Memory was freed at: 0 Electron Framework 0x000000012cacd6e0 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012cab6968 base::debug::StackTrace::StackTrace(unsigned long) + 168 2 Electron Framework 0x000000012cad3a24 base::allocator::(anonymous namespace)::DanglingRawPtrDetected(unsigned long) + 764 3 Electron Framework 0x000000012cbbb9ac void partition_alloc::PartitionRoot::FreeInline<(partition_alloc::internal::FreeFlags)22>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)22)>::Type) + 5868 4 Electron Framework 0x000000012cbb1264 void partition_alloc::PartitionRoot::FreeInUnknownRoot<(partition_alloc::internal::FreeFlags)22>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)22)>::Type) + 1324 5 Electron Framework 0x000000012cbd522c allocator_shim::internal::PartitionAllocFunctionsInternal<(partition_alloc::internal::AllocFlags)16, (partition_alloc::internal::FreeFlags)6>::FreeWithSize(void*, unsigned long, void*) + 200 6 Electron Framework 0x00000001258ed394 electron::NotificationPresenter::~NotificationPresenter() + 72 7 Electron Framework 0x0000000125a0ee60 electron::NotificationPresenterMac::~NotificationPresenterMac() + 356 8 Electron Framework 0x0000000125a0ef00 electron::NotificationPresenterMac::~NotificationPresenterMac() + 12 9 Electron Framework 0x0000000125868dfc electron::ElectronBrowserClient::~ElectronBrowserClient() + 500 The dangling raw_ptr was released at: 0 Electron Framework 0x000000012cacd6e0 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012cab6968 base::debug::StackTrace::StackTrace(unsigned long) + 168 2 Electron Framework 0x000000012cad3aec void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)0, (base::features::DanglingPtrType)0>(unsigned long) + 84 3 Electron Framework 0x000000012cb27fc8 base::internal::RawPtrBackupRefImpl<false>::ReleaseInternal(unsigned long) + 480 4 Electron Framework 0x00000001258b87c8 void std::__Cr::__destroy_at[abi:sqn240000]<base::raw_ptr<DraggableRegionProvider, (partition_alloc::internal::RawPtrTraits)0>>(base::raw_ptr<DraggableRegionProvider, (partition_alloc::internal::RawPtrTraits)0>*) + 136 5 Electron Framework 0x00000001258eda14 std::__Cr::__tree<base::raw_ptr<electron::Notification, (partition_alloc::internal::RawPtrTraits)0>, std::__Cr::less<base::raw_ptr<electron::Notification, (partition_alloc::internal::RawPtrTraits)0>>, std::__Cr::allocator<base::raw_ptr<electron::Notification, (partition_alloc::internal::RawPtrTraits)0>>>::__tree_deleter::operator()[abi:sqn240000](std::__Cr::__tree_node<base::raw_ptr<electron::Notification, (partition_alloc::internal::RawPtrTraits)0>, void*>*) + 52 6 Electron Framework 0x00000001258ed3d4 electron::NotificationPresenter::~NotificationPresenter() + 136 7 Electron Framework 0x0000000125a0ee60 electron::NotificationPresenterMac::~NotificationPresenterMac() + 356 8 Electron Framework 0x0000000125a0ef00 electron::NotificationPresenterMac::~NotificationPresenterMac() + 12 9 Electron Framework 0x0000000125868dfc electron::ElectronBrowserClient::~ElectronBrowserClient() + 500 * fix: clear Node environment before teardown Clear NodeBindings::uv_env_ before NodeService releases the node::Environment. Memory was freed at: 0 Electron Framework 0x0000000129b78940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x0000000129b63a00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x0000000129b7e86c base::allocator::(anonymous namespace)::DanglingRawPtrDetected(unsigned long) + 764 3 Electron Framework 0x0000000129c3c93c void partition_alloc::PartitionRoot::FreeInline<(partition_alloc::internal::FreeFlags)18>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)18)>::Type) + 8480 4 Electron Framework 0x0000000129c33390 void partition_alloc::PartitionRoot::FreeInUnknownRoot<(partition_alloc::internal::FreeFlags)18>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)18)>::Type) + 1324 5 Electron Framework 0x0000000129c56ce8 allocator_shim::internal::PartitionAllocFunctionsInternal<(partition_alloc::internal::AllocFlags)16, (partition_alloc::internal::FreeFlags)2>::FreeWithSize(void*, unsigned long, void*) + 200 6 Electron Framework 0x0000000122c4bd24 node::FreeEnvironment(node::Environment*) + 248 7 Electron Framework 0x0000000122b3a74c _ZNSt4__Cr20__shared_ptr_pointerB9sqn240000IPN4node11EnvironmentEZN8electron12NodeBindings17CreateEnvironmentEPN2v87IsolateENS6_5LocalINS6_7ContextEEEPNS1_20MultiIsolatePlatformEmNS_6vectorINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENSI_ISK_EEEESM_NS_8optionalIN4base17RepeatingCallbackIFvvEEEEEE3$_0NSI_IS2_EEE16__on_zero_sharedEv + 188 8 Electron Framework 0x0000000122b7ee40 electron::NodeService::~NodeService() + 416 9 Electron Framework 0x0000000122b7ef2c electron::NodeService::~NodeService() + 12 The dangling raw_ptr was released at: 0 Electron Framework 0x0000000129b78940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x0000000129b63a00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x0000000129b7e934 void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)0, (base::features::DanglingPtrType)0>(unsigned long) + 84 3 Electron Framework 0x0000000129bd03b4 base::internal::RawPtrBackupRefImpl<false>::ReleaseInternal(unsigned long) + 480 4 Electron Framework 0x0000000122b34b94 electron::NodeBindings::~NodeBindings() + 372 5 Electron Framework 0x0000000122bde08c electron::NodeBindingsMac::~NodeBindingsMac() + 12 6 Electron Framework 0x0000000122b7edf8 electron::NodeService::~NodeService() + 344 7 Electron Framework 0x0000000122b7ef2c electron::NodeService::~NodeService() + 12 * fix: enable dangling raw_ptr checks * fix: avoid retaining isolate in PromiseBase Resolve PromiseHandle traced references with the currently entered isolate instead of retaining a raw pointer that can outlive IsolateHolder. Promise operations already require execution on their creation thread with the isolate entered. ``` gin::IsolateHolder::~IsolateHolder -> JavascriptEnvironment::~JavascriptEnvironment -> isolate free static Promise<void> destruction -> PromiseBase::~PromiseBase -> isolate_ raw_ptr release ``` * fix: annotate additional dangling raw pointers * fix(win): annotate additional dangling raw_ptr | 21 天前 | |
build: enable more performance-* clang-tidy checks (#54024) * build: enable more performance-* clang-tidy checks * chore: performance-prefer-single-char-overloads Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: performance-unnecessary-copy-initialization Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: performance-use-std-move Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: performance-move-const-arg Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: performance-no-automatic-move Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: address review feedback Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MC6nEgyED2MtseZ9KdGMpt * chore: fix new clang-tidy performance findings Address performance-use-std-move, performance-move-const-arg, and performance-prefer-single-char-overloads findings in code that landed on main since the previous base. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MC6nEgyED2MtseZ9KdGMpt * chore: fix new clang-tidy performance findings on macOS Silence performance-unnecessary-copy-initialization for task runners captured by Objective-C blocks in the macOS file and message box dialogs, matching the existing pattern: the copy is needed since a block would otherwise capture the reference by reference. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MC6nEgyED2MtseZ9KdGMpt --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> | 1 天前 | |
perf: dispatch IPC to its JavaScript listeners natively (#53861) Every message from a renderer or service worker was emitted as a private '-ipc-*' event on the Session and fanned out by a JS listener that read a hidden internal flag through a native call, allocated reply()/returnValue closures per event, looked the sending WebFrameMain or ServiceWorkerMain up through another native call, and re-spread the argument array into each of up to four emit() calls. The event itself was a generic Event that had seven properties and an accessor defined on it one at a time per message. api::ipc_dispatch now delivers IPC directly: ipcMainInternal for internal channels, otherwise the WebContents ('ipc-message' / 'ipc-message-sync'), the sending frame's WebFrameMain.ipc, WebContents.ipc and ipcMain for frames, or the worker's ServiceWorkerMain.ipc for service workers, in the same order as before and inside a single callback scope so microtasks still run once afterwards. The event is an api::IpcMainEvent / IpcMainServiceWorkerEvent whose properties are native data properties of the instance template; event.reply, event.returnValue, event.serviceWorker, event.ports and the invoke reply are provided natively, and an invoke whose handler returned a plain value or a settled Promise replies from a microtask without allocating promise reactions. lib/browser/ipc-dispatch.ts is reduced to registering ipcMain, ipcMainInternal and MessagePortMain, and the IpcDispatcher mixin on Session is removed. The '-ipc-*' Session events are still emitted when something listens for them (IPC inspectors such as Devtron). | 1 个月前 | |
refactor: remove unused `#include "gin/..."` calls (#52651) * refactor: remove unused `#include "url/..."` calls * refactor: remove unused `#include "gin/..."` calls | 2 个月前 | |
refactor: simplify `NativeWindow`-to-`BaseWindow` lookup (#49520) refactor: simplify native window to base window lookup | 8 个月前 | |
refactor: add gin_helper and BaseWindow/WebContents helpers for native menus (#53873) - gin_helper::ConvertedValue<T>: a property store for cppgc wrappables that keeps the JS value a script assigned (for identity on read) together with its native conversion, done once at assignment. - gin_helper::Constructible: an optional FillInstanceTemplate() hook for own (instance) properties. - gin_helper::TrackableObject::GetAllNative(): the tracked instances without going through their wrappers. - BaseWindow::GetFocusedWindow() (now also backing BaseWindow.getFocusedWindow()), FromValue(), IsLive(), SetMenuNatively(). - WebContents::GetFocusedWebContents() and session(). | 1 个月前 | |
chore: remove deprecated wrappable support (#53758) * chore: remove deprecated wrappable support api::WebContents was the last user of gin_helper::DeprecatedWrappable and gin_helper::Pinnable, so drop both along with the generic helper overloads and template bookkeeping that only existed to keep the deprecated wrapper info working. The gin patch that restored the deprecated wrapper utilities can go with them, but the gin::PerIsolateData hook that notifies dispose observers before the microtasks runner is disposed is still needed, so reduce the patch to just that hook. * fix: preserve host object serialization Identify V8 API wrappers explicitly when deciding whether an object requires custom serialization instead of relying on its embedder field count. * chore: fix build * fix: cppgc wrappable detection for serialization | 1 个月前 | |
refactor: manage gin_helper callbacks with cppgc (#53678) * refactor: manage gin_helper callbacks with cppgc Build gin_helper callback holders on gin::internal::CallbackHolderBase, which wraps a cppgc managed object in v8::CppHeapExternal. This follows https://crrev.com/c/8485746, which is backported here as a Chromium patch until the next roll includes it. Because v8::CppHeapExternal is not a v8::Object, it has no creation context, so a FunctionTemplate or ObjectTemplate that caches a holder no longer retains a discarded context. This removes the need for the per-context template storage. * chore: address review feedback * chore: address review feedback | 17 天前 | |
build: enable dangling raw_ptr checks (#54619) * fix: clear vibrancy view before destruction Keep the removed NativeViewHost alive until vibrant_native_view_host_ has been cleared. Memory was freed at: 0 Electron Framework 0x000000012b8e4940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012b8cfa00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x000000012b8ea86c base::allocator::(anonymous namespace)::DanglingRawPtrDetected(unsigned long) + 764 3 Electron Framework 0x000000012b996bcc void partition_alloc::PartitionRoot::FreeInline<(partition_alloc::internal::FreeFlags)8>(void*) + 5392 4 Electron Framework 0x00000001335fe8f4 views::NativeViewHost::~NativeViewHost() + 16 5 Electron Framework 0x0000000124916004 ___ZN8electron15NativeWindowMac11SetVibrancyERKNSt4__Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEi_block_invoke + 140 6 Electron Framework 0x0000000124915a74 electron::NativeWindowMac::SetVibrancy(std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>> const&, int) + 1048 The dangling raw_ptr was released at: 0 Electron Framework 0x000000012b8e4940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012b8cfa00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x000000012b8eb158 void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)1, (base::features::DanglingPtrType)0>(unsigned long) + 92 3 Electron Framework 0x000000012b93c3b4 base::internal::RawPtrBackupRefImpl<false>::ReleaseInternal(unsigned long) + 480 4 Electron Framework 0x0000000124916058 ___ZN8electron15NativeWindowMac11SetVibrancyERKNSt4__Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEi_block_invoke + 224 5 Electron Framework 0x0000000124915a74 electron::NativeWindowMac::SetVibrancy(std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>> const&, int) + 1048 * fix: clear notification delegate before callback Release delegate_ before NotificationDestroyed() can synchronously delete the delegate. Memory was freed at: 0 Electron Framework 0x000000012b8e4940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012b8cfa00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x000000012b8ea86c base::allocator::(anonymous namespace)::DanglingRawPtrDetected(unsigned long) + 764 3 Electron Framework 0x000000012b9aa080 void partition_alloc::PartitionRoot::FreeInline<(partition_alloc::internal::FreeFlags)22>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)22)>::Type) + 5928 4 Electron Framework 0x000000012b99f940 void partition_alloc::PartitionRoot::FreeInUnknownRoot<(partition_alloc::internal::FreeFlags)22>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)22)>::Type) + 1324 5 Electron Framework 0x000000012b9c3a50 allocator_shim::internal::PartitionAllocFunctionsInternal<(partition_alloc::internal::AllocFlags)16, (partition_alloc::internal::FreeFlags)6>::FreeWithSize(void*, unsigned long, void*) + 200 6 Electron Framework 0x00000001247f797c electron::Notification::~Notification() + 72 7 Electron Framework 0x0000000124919fbc electron::CocoaNotification::~CocoaNotification() + 220 8 Electron Framework 0x000000012491a014 electron::CocoaNotification::~CocoaNotification() + 12 9 Electron Framework 0x00000001247f81cc electron::NotificationPresenter::RemoveNotification(electron::Notification*) + 200 The dangling raw_ptr was released at: 0 Electron Framework 0x000000012b8e4940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012b8cfa00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x000000012b8eb158 void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)1, (base::features::DanglingPtrType)0>(unsigned long) + 92 3 Electron Framework 0x000000012b93c3b4 base::internal::RawPtrBackupRefImpl<false>::ReleaseInternal(unsigned long) + 480 4 Electron Framework 0x00000001247f7a50 electron::Notification::~Notification() + 284 5 Electron Framework 0x0000000124919fbc electron::CocoaNotification::~CocoaNotification() + 220 6 Electron Framework 0x000000012491a014 electron::CocoaNotification::~CocoaNotification() + 12 7 Electron Framework 0x00000001247f81cc electron::NotificationPresenter::RemoveNotification(electron::Notification*) + 200 * fix: erase notifications before destruction Remove each raw_ptr from notifications_ before deleting the Notification it references. Memory was freed at: 0 Electron Framework 0x000000012cacd6e0 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012cab6968 base::debug::StackTrace::StackTrace(unsigned long) + 168 2 Electron Framework 0x000000012cad3a24 base::allocator::(anonymous namespace)::DanglingRawPtrDetected(unsigned long) + 764 3 Electron Framework 0x000000012cbbb9ac void partition_alloc::PartitionRoot::FreeInline<(partition_alloc::internal::FreeFlags)22>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)22)>::Type) + 5868 4 Electron Framework 0x000000012cbb1264 void partition_alloc::PartitionRoot::FreeInUnknownRoot<(partition_alloc::internal::FreeFlags)22>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)22)>::Type) + 1324 5 Electron Framework 0x000000012cbd522c allocator_shim::internal::PartitionAllocFunctionsInternal<(partition_alloc::internal::AllocFlags)16, (partition_alloc::internal::FreeFlags)6>::FreeWithSize(void*, unsigned long, void*) + 200 6 Electron Framework 0x00000001258ed394 electron::NotificationPresenter::~NotificationPresenter() + 72 7 Electron Framework 0x0000000125a0ee60 electron::NotificationPresenterMac::~NotificationPresenterMac() + 356 8 Electron Framework 0x0000000125a0ef00 electron::NotificationPresenterMac::~NotificationPresenterMac() + 12 9 Electron Framework 0x0000000125868dfc electron::ElectronBrowserClient::~ElectronBrowserClient() + 500 The dangling raw_ptr was released at: 0 Electron Framework 0x000000012cacd6e0 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012cab6968 base::debug::StackTrace::StackTrace(unsigned long) + 168 2 Electron Framework 0x000000012cad3aec void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)0, (base::features::DanglingPtrType)0>(unsigned long) + 84 3 Electron Framework 0x000000012cb27fc8 base::internal::RawPtrBackupRefImpl<false>::ReleaseInternal(unsigned long) + 480 4 Electron Framework 0x00000001258b87c8 void std::__Cr::__destroy_at[abi:sqn240000]<base::raw_ptr<DraggableRegionProvider, (partition_alloc::internal::RawPtrTraits)0>>(base::raw_ptr<DraggableRegionProvider, (partition_alloc::internal::RawPtrTraits)0>*) + 136 5 Electron Framework 0x00000001258eda14 std::__Cr::__tree<base::raw_ptr<electron::Notification, (partition_alloc::internal::RawPtrTraits)0>, std::__Cr::less<base::raw_ptr<electron::Notification, (partition_alloc::internal::RawPtrTraits)0>>, std::__Cr::allocator<base::raw_ptr<electron::Notification, (partition_alloc::internal::RawPtrTraits)0>>>::__tree_deleter::operator()[abi:sqn240000](std::__Cr::__tree_node<base::raw_ptr<electron::Notification, (partition_alloc::internal::RawPtrTraits)0>, void*>*) + 52 6 Electron Framework 0x00000001258ed3d4 electron::NotificationPresenter::~NotificationPresenter() + 136 7 Electron Framework 0x0000000125a0ee60 electron::NotificationPresenterMac::~NotificationPresenterMac() + 356 8 Electron Framework 0x0000000125a0ef00 electron::NotificationPresenterMac::~NotificationPresenterMac() + 12 9 Electron Framework 0x0000000125868dfc electron::ElectronBrowserClient::~ElectronBrowserClient() + 500 * fix: clear Node environment before teardown Clear NodeBindings::uv_env_ before NodeService releases the node::Environment. Memory was freed at: 0 Electron Framework 0x0000000129b78940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x0000000129b63a00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x0000000129b7e86c base::allocator::(anonymous namespace)::DanglingRawPtrDetected(unsigned long) + 764 3 Electron Framework 0x0000000129c3c93c void partition_alloc::PartitionRoot::FreeInline<(partition_alloc::internal::FreeFlags)18>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)18)>::Type) + 8480 4 Electron Framework 0x0000000129c33390 void partition_alloc::PartitionRoot::FreeInUnknownRoot<(partition_alloc::internal::FreeFlags)18>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)18)>::Type) + 1324 5 Electron Framework 0x0000000129c56ce8 allocator_shim::internal::PartitionAllocFunctionsInternal<(partition_alloc::internal::AllocFlags)16, (partition_alloc::internal::FreeFlags)2>::FreeWithSize(void*, unsigned long, void*) + 200 6 Electron Framework 0x0000000122c4bd24 node::FreeEnvironment(node::Environment*) + 248 7 Electron Framework 0x0000000122b3a74c _ZNSt4__Cr20__shared_ptr_pointerB9sqn240000IPN4node11EnvironmentEZN8electron12NodeBindings17CreateEnvironmentEPN2v87IsolateENS6_5LocalINS6_7ContextEEEPNS1_20MultiIsolatePlatformEmNS_6vectorINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENSI_ISK_EEEESM_NS_8optionalIN4base17RepeatingCallbackIFvvEEEEEE3$_0NSI_IS2_EEE16__on_zero_sharedEv + 188 8 Electron Framework 0x0000000122b7ee40 electron::NodeService::~NodeService() + 416 9 Electron Framework 0x0000000122b7ef2c electron::NodeService::~NodeService() + 12 The dangling raw_ptr was released at: 0 Electron Framework 0x0000000129b78940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x0000000129b63a00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x0000000129b7e934 void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)0, (base::features::DanglingPtrType)0>(unsigned long) + 84 3 Electron Framework 0x0000000129bd03b4 base::internal::RawPtrBackupRefImpl<false>::ReleaseInternal(unsigned long) + 480 4 Electron Framework 0x0000000122b34b94 electron::NodeBindings::~NodeBindings() + 372 5 Electron Framework 0x0000000122bde08c electron::NodeBindingsMac::~NodeBindingsMac() + 12 6 Electron Framework 0x0000000122b7edf8 electron::NodeService::~NodeService() + 344 7 Electron Framework 0x0000000122b7ef2c electron::NodeService::~NodeService() + 12 * fix: enable dangling raw_ptr checks * fix: avoid retaining isolate in PromiseBase Resolve PromiseHandle traced references with the currently entered isolate instead of retaining a raw pointer that can outlive IsolateHolder. Promise operations already require execution on their creation thread with the isolate entered. ``` gin::IsolateHolder::~IsolateHolder -> JavascriptEnvironment::~JavascriptEnvironment -> isolate free static Promise<void> destruction -> PromiseBase::~PromiseBase -> isolate_ raw_ptr release ``` * fix: annotate additional dangling raw pointers * fix(win): annotate additional dangling raw_ptr | 21 天前 | |
feat: add app shims on macOS (#54932) * feat: add app shims on macOS An app shim is a small app, in a bundle of its own, that shows windows on behalf of a host Electron app. The host still creates each window, loads its page and handles its events, but the NSWindow belongs to the shim's process, so the Dock, the app switcher, Mission Control and Stage Manager attribute the window to the shim and not to the host. - `app.startAppShimServer()` / `app.stopAppShimServer()` and the `app-shim-connected` event, which hands over an `AppShimHost`. - A `BaseWindow` / `BrowserWindow` created with the `appShim` option has its native window made in that shim's process, through Chromium's remote_cocoa. Such a window is a new NativeWindow implementation that only goes through views::Widget; what remote_cocoa has no call for is a no-op (see docs/api/app-shim-host.md). - The shim's executable is `Helpers/app_shim_loader` from the framework bundle. It links nothing from Electron: it loads the host's framework and calls the new `ElectronAppShimMain` export, which runs an `app-shim` process that connects back to the host over a Mach bootstrap server. - Electron Framework gains an rpath to the folder it is in, so that it finds its sibling frameworks when an executable in another bundle loads it. Not available in Mac App Store builds. Co-Authored-By: Claude <noreply@anthropic.com> * feat: app shim menus, dialogs, window chrome and review fixes Follow-up to the first app shim commit. Fixes from review: - A window torn down from one of its own listeners (shim.quit() or win.destroy() in `show`) no longer frees the native host that is notifying. - The native close button no longer leaves the shim waiting on an answer that was dropped with the window. - Keys the page does not handle go back to the shim, whose menu they are shortcuts of, and not to the host's menu. - stopAppShimServer() drops shims that have connected and not said hello. - Quitting a shim asks the host without blocking and without cancelling a logout; quit-requested can now be answered with "no". - Size limits and useContentSize are in content sizes; restore() and unmaximize() each do one thing; webContents.isFocused() works. New: - shim.setMenu(): a menu bar of the shim's own, built in the shim from a description of the Menu, with clicks sent back. - Message boxes and open and save dialogs are sheets of the window in the shim's process. - titleBarStyle, traffic light position and visibility, vibrancy, tabs and Quick Look, applied in the shim to the NSWindow that remote_cocoa made. - A Chromium patch for what remote_cocoa has no call for: movable, closable, minimizable and fullscreenable, clearing an aspect ratio, and yielding activation to the hosting process by pid. - A shim that loaded another build of Electron than the running host tells the host and quits: app-shim-version-mismatch. The API is marked experimental in the docs. Co-Authored-By: Claude <noreply@anthropic.com> * fix: address review of app shims - A window in an app shim can't be given a parent, at construction or with setParentWindow(), as the docs say. - shim.setMenu() is now shim.setApplicationMenu(). - A message box that is showing under an id makes way for a new one with that id, whichever process shows it. - Mac App Store builds no longer export the shim's entry point; they already had no loader. - setProgressBar() and setHasShadow() are listed among what does nothing on a window in a shim. - The spec no longer asserts inside an event listener. Co-Authored-By: Claude <noreply@anthropic.com> * fix: clang-tidy findings in app shim code * docs: reword the app shim docs for clarity * chore: update patches Re-exported after rebasing onto Chromium 158.0.8105.0; only line offsets changed. Co-Authored-By: Claude <noreply@anthropic.com> * test: use vitest matchers in the app shim spec --------- Co-authored-by: Claude <noreply@anthropic.com> | 8 天前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 3 年前 | ||
| 30 天前 | ||
| 30 天前 | ||
| 6 天前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 17 天前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 6 天前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 6 个月前 | ||
| 1 年前 | ||
| 1 个月前 | ||
| 5 个月前 | ||
| 1 个月前 | ||
| 17 天前 | ||
| 3 年前 | ||
| 17 天前 | ||
| 1 天前 | ||
| 17 天前 | ||
| 17 天前 | ||
| 17 天前 | ||
| 2 个月前 | ||
| 1 个月前 | ||
| 26 天前 | ||
| 1 个月前 | ||
| 5 个月前 | ||
| 5 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 6 天前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 2 年前 | ||
| 30 天前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 6 年前 | ||
| 1 年前 | ||
| 21 天前 | ||
| 21 天前 | ||
| 1 天前 | ||
| 1 个月前 | ||
| 2 个月前 | ||
| 8 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 17 天前 | ||
| 21 天前 | ||
| 8 天前 |