* perf: avoid double-calls to GetView()
There are a lot of places where we call the virtual method GetView()
twice in succession: the first to check if the view exists, and the
second to use. This PR holds the view in a temp variable instead, e.g.:
if (auto* view = foo->GetView())
view->DoSomething();
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* perf: avoid discarded GetView() call
Co-authored-by: Charles Kerr <charles@charleskerr.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* chore: [31-x-y] cherry-pick 3 changes from 0-M127
* 44b7fbf35b10 from chromium
* c9815acd5a88 from dawn
* 9463ce9cd8d9 from DirectXShaderCompiler
* chore: e patches all
---------
Co-authored-by: Charles Kerr <charles@charleskerr.com>
chore: remove unused unSetVar JS binding
Added in Oct 2020 (b33f2260, #25623) but never used
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* fix: handle failing to enter/exit fullscreen on macOS
On macOS, failing to enter/exit fullscreen can fail. If this happens,
properly restore the original window state.
Co-authored-by: cptpcrd <31829097+cptpcrd@users.noreply.github.com>
* refactor: remove fail to exit fullscreen handlers
Seem to be unnecessary since the window exits fullscreen anyway.
Co-authored-by: cptpcrd <31829097+cptpcrd@users.noreply.github.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: cptpcrd <31829097+cptpcrd@users.noreply.github.com>
chore: remove unused v8Util.deleteHiddenValue()
Its last use was removed in Nov 2020 by c8d77cae4a (#26659)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
The last three pieces of code that used it were removed in:
- Oct 2020 (8df4faa8#25711)
- Jun 2020 (e1e73fa5#24115)
- Jun 2020 (c0182bca#24116).
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
chore: remove unused class `electron::ObjectLifeMonitor` (#43089)
The last users were removed in June 2020 e1e73fa5f (#24115)
and May 2020 9d7ba982 (#23592).
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
`.destroy()` is an important method in the lifecycle of a Node.js
Readable stream. It is typically called to reclaim the resources
(e.g., close file descriptor). The only situations where calling
it manually isn't necessary are when the following events are
emitted first:
- `end`: natural end of a stream
- `error`: stream terminated due to a failure
Prior to this commit the ended state was incorrectly tracked together
with a pending internal error. It led to situations where the request
could get aborted during a read and then get marked as ended (having
pending error).
With this change we disentangle pending "error" and "destroyed" cases to
always properly terminate an active Node.js Readable stream.
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
* avoid crash of operation on an invalid entry while erase set iterator.
Co-authored-by: bill.shen <shenyb32768@gmail.com>
* fix notification removal crash due to the nullptr presenter
Co-authored-by: bill.shen <shenyb32768@gmail.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: bill.shen <shenyb32768@gmail.com>
fix: active File System API permissions should reset on WebContents destruction
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
v8::Handle is an alias for v8::Local that "is kept around for historical
reasons" and is disabled when V8_IMMINENT_DEPRECATION_WARNING is defined
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
refactor: remove WindowListObserver::OnWindowRemove()
these have never been used
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
last caller removed in 67ba3040 (#37902)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
last caller removed in 6159066c (#22916)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
chore: remove unused typedef ElectronDownloadManagerDelegate::CreateDownloadPathCallback
use was removed in e3c580e9
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
On the Mac platform, OffScreenWebContentsView uses Automatic Reference
Counting (ARC) to handle the lifecycle of offScreenView_. However, this
private member variable is not initialized and its value is undefined.
In some cases, it is initialized to a garbage value, which may cause ARC
to release the value incorrectly, resulting in a crash.
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jinli Wu <wujinli@bytedance.com>
fix: BrowserWindow.setBackgroundColor should work with transparency
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>