mirror of
https://github.com/electron/electron.git
synced 2026-03-19 03:02:02 -04:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e094b3939e | ||
|
|
339d44c723 | ||
|
|
ee2d3db030 | ||
|
|
139e238d07 | ||
|
|
a1550f5102 | ||
|
|
3dd04c2725 | ||
|
|
d32b8a64d0 | ||
|
|
425fe98c14 | ||
|
|
6b4b7df937 | ||
|
|
cc81658f40 |
2
.github/actions/checkout/action.yml
vendored
2
.github/actions/checkout/action.yml
vendored
@@ -43,7 +43,7 @@ runs:
|
||||
curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$CACHE_FILE?platform=${{ inputs.target-platform }}&getAccountName=true" > sas-token
|
||||
- name: Save SAS Key
|
||||
if: ${{ inputs.generate-sas-token == 'true' }}
|
||||
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||
uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
|
||||
with:
|
||||
path: sas-token
|
||||
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }}
|
||||
|
||||
@@ -7,7 +7,7 @@ runs:
|
||||
shell: bash
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(node src/electron/script/yarn.js config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||
- uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
@@ -209,6 +209,7 @@ jobs:
|
||||
|
||||
- name: Run Electron Tests
|
||||
shell: bash
|
||||
timeout-minutes: 40
|
||||
env:
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
|
||||
@@ -259,6 +260,19 @@ jobs:
|
||||
|
||||
fi
|
||||
fi
|
||||
- name: Take screenshot on timeout or cancellation
|
||||
if: ${{ inputs.target-platform != 'linux' && (cancelled() || failure()) }}
|
||||
shell: bash
|
||||
run: |
|
||||
screenshot_dir="src/electron/spec/artifacts"
|
||||
mkdir -p "$screenshot_dir"
|
||||
screenshot_file="$screenshot_dir/screenshot-timeout-$(date +%Y%m%d%H%M%S).png"
|
||||
if [ "${{ inputs.target-platform }}" = "macos" ]; then
|
||||
screencapture -x "$screenshot_file" || true
|
||||
elif [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
powershell -command "Add-Type -AssemblyName System.Windows.Forms; \$screen = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds; \$bitmap = New-Object System.Drawing.Bitmap(\$screen.Width, \$screen.Height); \$graphics = [System.Drawing.Graphics]::FromImage(\$bitmap); \$graphics.CopyFromScreen(\$screen.Location, [System.Drawing.Point]::Empty, \$screen.Size); \$bitmap.Save('$screenshot_file')" || true
|
||||
fi
|
||||
|
||||
- name: Upload Test results to Datadog
|
||||
env:
|
||||
DD_ENV: ci
|
||||
@@ -274,7 +288,7 @@ jobs:
|
||||
fi
|
||||
if: always() && !cancelled()
|
||||
- name: Upload Test Artifacts
|
||||
if: always() && !cancelled()
|
||||
if: always()
|
||||
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
|
||||
with:
|
||||
name: test_artifacts_${{ env.ARTIFACT_KEY }}_${{ matrix.shard }}
|
||||
|
||||
@@ -1232,6 +1232,8 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
// has filesystem caching.
|
||||
overrideAPI(fs, 'copyFile');
|
||||
overrideAPISync(fs, 'copyFileSync');
|
||||
overrideAPI(fs, 'cp');
|
||||
overrideAPISync(fs, 'cpSync');
|
||||
|
||||
overrideAPI(fs, 'open');
|
||||
overrideAPISync(process, 'dlopen', 1);
|
||||
|
||||
@@ -150,3 +150,4 @@ loaf_add_feature_to_enable_sourceurl_for_all_protocols.patch
|
||||
fix_update_dbus_signal_signature_for_xdg_globalshortcuts_portal.patch
|
||||
patch_osr_control_screen_info.patch
|
||||
cherry-pick-12f932985275.patch
|
||||
fix_mac_high_res_icons.patch
|
||||
|
||||
80
patches/chromium/fix_mac_high_res_icons.patch
Normal file
80
patches/chromium/fix_mac_high_res_icons.patch
Normal file
@@ -0,0 +1,80 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Kanishk Ranjan <kanishkranjan17@gmail.com>
|
||||
Date: Thu, 11 Dec 2025 10:03:47 -0800
|
||||
Subject: Mac: Fix WebRTC window icon conversion via gfx::Image
|
||||
|
||||
The current WebRTC window picker implementation tries to manually convert
|
||||
NSImages to ImageSkia, but it does this incorrectly. As a result, the
|
||||
icons can appear corrupted or blank.
|
||||
|
||||
This CL resolves the issue by using gfx::Image for the conversion. This
|
||||
method offers a reliable and standard way to change an NSImage into an
|
||||
ImageSkia.
|
||||
|
||||
Feature-Flag: kUseGfxImageForMacWindowIcons
|
||||
Bug: 465028835
|
||||
Change-Id: Ib69bc151e9542d2402c1cd7d282e5f3298581862
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7239386
|
||||
Reviewed-by: Elad Alon <eladalon@chromium.org>
|
||||
Commit-Queue: Avi Drissman <avi@chromium.org>
|
||||
Reviewed-by: Avi Drissman <avi@chromium.org>
|
||||
Reviewed-by: Tove Petersson <tovep@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1557501}
|
||||
|
||||
diff --git a/AUTHORS b/AUTHORS
|
||||
index 7eb8f26120a23539b0780eb3f7e1d6a7ac52b102..fb0796cabdec4419e953306608a5b816ea1f2662 100644
|
||||
--- a/AUTHORS
|
||||
+++ b/AUTHORS
|
||||
@@ -824,6 +824,7 @@ Kamil Rytarowski <krytarowski@gmail.com>
|
||||
Kanaru Sato <i.am.kanaru.sato@gmail.com>
|
||||
Kangil Han <kangil.han@samsung.com>
|
||||
Kangyuan Shu <kangyuan.shu@intel.com>
|
||||
+Kanishk Ranjan <kanishkranjan17@gmail.com>
|
||||
Karan Thakkar <karanjthakkar@gmail.com>
|
||||
Karel Král <kralkareliv@gmail.com>
|
||||
Karl <karlpolicechromium@gmail.com>
|
||||
diff --git a/chrome/browser/media/webrtc/window_icon_util_mac.mm b/chrome/browser/media/webrtc/window_icon_util_mac.mm
|
||||
index 8bd216b9da864c9a8b82231ce6613cc120b32de7..c37b753c6aaf3b5036aacc74b310343fc7379188 100644
|
||||
--- a/chrome/browser/media/webrtc/window_icon_util_mac.mm
|
||||
+++ b/chrome/browser/media/webrtc/window_icon_util_mac.mm
|
||||
@@ -8,9 +8,19 @@
|
||||
|
||||
#include "base/apple/foundation_util.h"
|
||||
#include "base/apple/scoped_cftyperef.h"
|
||||
+#include "base/feature_list.h"
|
||||
+#include "ui/gfx/image/image.h"
|
||||
+#include "ui/gfx/image/image_skia.h"
|
||||
+
|
||||
+// TODO(crbug.com/465028835): Remove these includes and the fallback code once
|
||||
+// kUseGfxImageForMacWindowIcons is stable and the feature flag is removed
|
||||
#include "third_party/libyuv/include/libyuv/convert_argb.h"
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
|
||||
+BASE_FEATURE(kUseGfxImageForMacWindowIcons,
|
||||
+ "UseGfxImageForMacWindowIcons",
|
||||
+ base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
+
|
||||
gfx::ImageSkia GetWindowIcon(content::DesktopMediaID id) {
|
||||
DCHECK(id.type == content::DesktopMediaID::TYPE_WINDOW);
|
||||
|
||||
@@ -35,6 +45,20 @@
|
||||
NSImage* icon_image =
|
||||
[[NSRunningApplication runningApplicationWithProcessIdentifier:pid] icon];
|
||||
|
||||
+ // TODO(crbug.com/465028835): Remove this feature check and the fallback
|
||||
+ // path once kUseGfxImageForMacWindowIcons is stable and the flag is removed
|
||||
+ if (base::FeatureList::IsEnabled(kUseGfxImageForMacWindowIcons)) {
|
||||
+ // The app may have terminated, resulting in a nil icon.
|
||||
+ if (!icon_image) {
|
||||
+ return gfx::ImageSkia();
|
||||
+ }
|
||||
+
|
||||
+ return gfx::Image(icon_image).AsImageSkia();
|
||||
+ }
|
||||
+
|
||||
+ // TODO(crbug.com/465028835): Remove the code below this line once
|
||||
+ // kUseGfxImageForMacWindowIcons is stable and the flag is removed.
|
||||
+
|
||||
// Icon's NSImage defaults to the smallest which can be only 32x32.
|
||||
NSRect proposed_rect = NSMakeRect(0, 0, 128, 128);
|
||||
CGImageRef cg_icon_image =
|
||||
@@ -1 +1,2 @@
|
||||
chore_expose_ui_to_allow_electron_to_set_dock_side.patch
|
||||
fix_prefer_browser_runtime_over_node_in_hostruntime_detection.patch
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Thu, 12 Mar 2026 17:03:29 +0100
|
||||
Subject: fix: prefer browser runtime over node in HostRuntime detection
|
||||
|
||||
In Electron, the `process` global is available in renderer processes,
|
||||
including the DevTools renderer. This causes the IS_NODE check to pass,
|
||||
leading DevTools to attempt importing the Node.js platform runtime
|
||||
(which uses `node:worker_threads`). However, DevTools Web Workers
|
||||
running under the `devtools://` protocol don't have access to Node.js
|
||||
built-in modules, resulting in a failed dynamic import.
|
||||
|
||||
Fix by checking IS_BROWSER first, since DevTools always runs in a
|
||||
browser-like environment. The Node.js runtime is only needed when
|
||||
DevTools runs under pure Node.js (e.g., CLI tooling or testing).
|
||||
|
||||
diff --git a/front_end/core/platform/HostRuntime.ts b/front_end/core/platform/HostRuntime.ts
|
||||
index 91adba7c966a9c4c0e5315d2cfee07f8f622b731..16822b8d4ea74a4ffd6870e5e95948d75918f5d2 100644
|
||||
--- a/front_end/core/platform/HostRuntime.ts
|
||||
+++ b/front_end/core/platform/HostRuntime.ts
|
||||
@@ -14,12 +14,12 @@ export const IS_BROWSER =
|
||||
typeof window !== 'undefined' || (typeof self !== 'undefined' && typeof self.postMessage === 'function');
|
||||
|
||||
export const HOST_RUNTIME = await (async(): Promise<Api.HostRuntime.HostRuntime> => {
|
||||
- if (IS_NODE) {
|
||||
- return (await import('./node/node.js')).HostRuntime.HOST_RUNTIME;
|
||||
- }
|
||||
if (IS_BROWSER) {
|
||||
return (await import('./browser/browser.js')).HostRuntime.HOST_RUNTIME;
|
||||
}
|
||||
+ if (IS_NODE) {
|
||||
+ return (await import('./node/node.js')).HostRuntime.HOST_RUNTIME;
|
||||
+ }
|
||||
|
||||
throw new Error('Unknown runtime!');
|
||||
})();
|
||||
@@ -17,7 +17,7 @@ Upstreams:
|
||||
- https://github.com/nodejs/node/pull/39136
|
||||
|
||||
diff --git a/deps/ncrypto/ncrypto.cc b/deps/ncrypto/ncrypto.cc
|
||||
index 461819ce0fa732048e4365c40a86ef55d984c35f..fa55c980a9c4f373723a867fd41276d67b0b9413 100644
|
||||
index 461819ce0fa732048e4365c40a86ef55d984c35f..f1c85e94cf526d0255f47c003664680d26413ec3 100644
|
||||
--- a/deps/ncrypto/ncrypto.cc
|
||||
+++ b/deps/ncrypto/ncrypto.cc
|
||||
@@ -11,6 +11,7 @@
|
||||
@@ -28,38 +28,6 @@ index 461819ce0fa732048e4365c40a86ef55d984c35f..fa55c980a9c4f373723a867fd41276d6
|
||||
#if OPENSSL_VERSION_MAJOR >= 3
|
||||
#include <openssl/core_names.h>
|
||||
#include <openssl/params.h>
|
||||
@@ -1130,7 +1131,9 @@ int64_t X509View::getValidToTime() const {
|
||||
return tp;
|
||||
#else
|
||||
struct tm tp;
|
||||
- ASN1_TIME_to_tm(X509_get0_notAfter(cert_), &tp);
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
+ ASN1_TIME_to_tm(X509_get0_notAfter(cert_), &tp);
|
||||
+#endif
|
||||
return PortableTimeGM(&tp);
|
||||
#endif
|
||||
}
|
||||
@@ -1142,7 +1145,9 @@ int64_t X509View::getValidFromTime() const {
|
||||
return tp;
|
||||
#else
|
||||
struct tm tp;
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
ASN1_TIME_to_tm(X509_get0_notBefore(cert_), &tp);
|
||||
+#endif
|
||||
return PortableTimeGM(&tp);
|
||||
#endif
|
||||
}
|
||||
@@ -2886,10 +2891,6 @@ std::optional<uint32_t> SSLPointer::verifyPeerCertificate() const {
|
||||
const char* SSLPointer::getClientHelloAlpn() const {
|
||||
if (ssl_ == nullptr) return {};
|
||||
#ifndef OPENSSL_IS_BORINGSSL
|
||||
- const unsigned char* buf;
|
||||
- size_t len;
|
||||
- size_t rem;
|
||||
-
|
||||
if (!SSL_client_hello_get0_ext(
|
||||
get(),
|
||||
TLSEXT_TYPE_application_layer_protocol_negotiation,
|
||||
@@ -3090,9 +3091,11 @@ const Cipher Cipher::AES_256_GCM = Cipher::FromNid(NID_aes_256_gcm);
|
||||
const Cipher Cipher::AES_128_KW = Cipher::FromNid(NID_id_aes128_wrap);
|
||||
const Cipher Cipher::AES_192_KW = Cipher::FromNid(NID_id_aes192_wrap);
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
graphite_add_insertstatus_koutoforderrecording.patch
|
||||
cherry-pick-7911bee5d90e.patch
|
||||
|
||||
539
patches/skia/cherry-pick-7911bee5d90e.patch
Normal file
539
patches/skia/cherry-pick-7911bee5d90e.patch
Normal file
@@ -0,0 +1,539 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Greg Daniel <egdaniel@google.com>
|
||||
Date: Wed, 11 Mar 2026 15:29:58 -0400
|
||||
Subject: Make sure we are getting the correct atlas for glyph mask format.
|
||||
|
||||
Bug: b/491421267
|
||||
Change-Id: I4eacd46599eca2df8c10a3fc894b9ce890fae1e2
|
||||
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1184076
|
||||
Commit-Queue: Greg Daniel <egdaniel@google.com>
|
||||
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
|
||||
(cherry picked from commit 0cab3e4ee34b3bca6ba7df676639d73ffe4b2135)
|
||||
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1184917
|
||||
|
||||
diff --git a/bench/GlyphQuadFillBench.cpp b/bench/GlyphQuadFillBench.cpp
|
||||
index 6793512e216b00e1f8112f8e681eecf5beee8fe8..4fd0965185f8bab5a55ec63329bf6aa36ad56ed0 100644
|
||||
--- a/bench/GlyphQuadFillBench.cpp
|
||||
+++ b/bench/GlyphQuadFillBench.cpp
|
||||
@@ -68,7 +68,7 @@ class DirectMaskGlyphVertexFillBenchmark : public Benchmark {
|
||||
const sktext::gpu::AtlasSubRun* subRun =
|
||||
sktext::gpu::TextBlobTools::FirstSubRun(fBlob.get());
|
||||
SkASSERT_RELEASE(subRun);
|
||||
- subRun->testingOnly_packedGlyphIDToGlyph(&fCache);
|
||||
+ subRun->testingOnly_packedGlyphIDToGlyph(&fCache, subRun->maskFormat());
|
||||
fVertices.reset(new char[subRun->vertexStride(drawMatrix) * subRun->glyphCount() * 4]);
|
||||
}
|
||||
|
||||
diff --git a/gn/tests.gni b/gn/tests.gni
|
||||
index 8ae89364ce33f62ced5e8ff5b417a0cf69a3afb1..6286969c91fa9dff8d1e83413ab5b9fd514c5ae9 100644
|
||||
--- a/gn/tests.gni
|
||||
+++ b/gn/tests.gni
|
||||
@@ -424,6 +424,7 @@ pathops_tests_sources = [
|
||||
ganesh_tests_sources = [
|
||||
"$_tests/AdvancedBlendTest.cpp",
|
||||
"$_tests/ApplyGammaTest.cpp",
|
||||
+ "$_tests/AtlasOobTest.cpp",
|
||||
"$_tests/BackendAllocationTest.cpp",
|
||||
"$_tests/BackendSurfaceMutableStateTest.cpp",
|
||||
"$_tests/BlendTest.cpp",
|
||||
diff --git a/src/gpu/ganesh/text/GrAtlasManager.cpp b/src/gpu/ganesh/text/GrAtlasManager.cpp
|
||||
index 403bfe274e56293bfe2382b02525ae742ba541a7..1e7d9aa0ce14f19e09d79544730c6aa922ae37d6 100644
|
||||
--- a/src/gpu/ganesh/text/GrAtlasManager.cpp
|
||||
+++ b/src/gpu/ganesh/text/GrAtlasManager.cpp
|
||||
@@ -178,8 +178,7 @@ GrDrawOpAtlas::ErrorCode GrAtlasManager::addGlyphToAtlas(const SkGlyph& skGlyph,
|
||||
}
|
||||
SkASSERT(glyph != nullptr);
|
||||
|
||||
- MaskFormat glyphFormat = Glyph::FormatFromSkGlyph(skGlyph.maskFormat());
|
||||
- MaskFormat expectedMaskFormat = this->resolveMaskFormat(glyphFormat);
|
||||
+ MaskFormat expectedMaskFormat = this->resolveMaskFormat(glyph->fGlyphEntryKey.fFormat);
|
||||
int bytesPerPixel = MaskFormatBytesPerPixel(expectedMaskFormat);
|
||||
|
||||
int padding;
|
||||
@@ -299,7 +298,7 @@ std::tuple<bool, int> GlyphVector::regenerateAtlasForGanesh(
|
||||
|
||||
uint64_t currentAtlasGen = atlasManager->atlasGeneration(maskFormat);
|
||||
|
||||
- this->packedGlyphIDToGlyph(target->strikeCache());
|
||||
+ this->packedGlyphIDToGlyph(target->strikeCache(), maskFormat);
|
||||
|
||||
if (fAtlasGeneration != currentAtlasGen) {
|
||||
// Calculate the texture coordinates for the vertexes during first use (fAtlasGeneration
|
||||
@@ -316,9 +315,10 @@ std::tuple<bool, int> GlyphVector::regenerateAtlasForGanesh(
|
||||
for (const Variant& variant : glyphs) {
|
||||
Glyph* gpuGlyph = variant.glyph;
|
||||
SkASSERT(gpuGlyph != nullptr);
|
||||
-
|
||||
+ SkASSERT(gpuGlyph->fGlyphEntryKey.fFormat == maskFormat);
|
||||
if (!atlasManager->hasGlyph(maskFormat, gpuGlyph)) {
|
||||
- const SkGlyph& skGlyph = *metricsAndImages.glyph(gpuGlyph->fPackedID);
|
||||
+ const SkGlyph& skGlyph =
|
||||
+ *metricsAndImages.glyph(gpuGlyph->fGlyphEntryKey.fPackedID);
|
||||
auto code = atlasManager->addGlyphToAtlas(
|
||||
skGlyph, gpuGlyph, srcPadding, target->resourceProvider(), uploadTarget);
|
||||
if (code != GrDrawOpAtlas::ErrorCode::kSucceeded) {
|
||||
diff --git a/src/gpu/graphite/Device.cpp b/src/gpu/graphite/Device.cpp
|
||||
index 1163eacd741d059b5a782112d9dbeed7080e3207..b069ba5e84bf113f3e1bcff1cd7c8e9ef570722d 100644
|
||||
--- a/src/gpu/graphite/Device.cpp
|
||||
+++ b/src/gpu/graphite/Device.cpp
|
||||
@@ -1427,6 +1427,7 @@ void Device::drawAtlasSubRun(const sktext::gpu::AtlasSubRun* subRun,
|
||||
int padding) {
|
||||
return glyphs->regenerateAtlasForGraphite(begin, end, maskFormat, padding, fRecorder);
|
||||
};
|
||||
+
|
||||
for (int subRunCursor = 0; subRunCursor < subRunEnd;) {
|
||||
// For the remainder of the run, add any atlas uploads to the Recorder's TextAtlasManager
|
||||
auto[ok, glyphsRegenerated] = subRun->regenerateAtlas(subRunCursor, subRunEnd,
|
||||
diff --git a/src/gpu/graphite/text/TextAtlasManager.cpp b/src/gpu/graphite/text/TextAtlasManager.cpp
|
||||
index 6602a76c150bff077666fb91b990d3e45d528ce2..cbb51a66846922995912c3159afba879a2487313 100644
|
||||
--- a/src/gpu/graphite/text/TextAtlasManager.cpp
|
||||
+++ b/src/gpu/graphite/text/TextAtlasManager.cpp
|
||||
@@ -207,8 +207,7 @@ DrawAtlas::ErrorCode TextAtlasManager::addGlyphToAtlas(const SkGlyph& skGlyph,
|
||||
}
|
||||
SkASSERT(glyph != nullptr);
|
||||
|
||||
- MaskFormat glyphFormat = Glyph::FormatFromSkGlyph(skGlyph.maskFormat());
|
||||
- MaskFormat expectedMaskFormat = this->resolveMaskFormat(glyphFormat);
|
||||
+ MaskFormat expectedMaskFormat = this->resolveMaskFormat(glyph->fGlyphEntryKey.fFormat);
|
||||
int bytesPerPixel = MaskFormatBytesPerPixel(expectedMaskFormat);
|
||||
|
||||
int padding;
|
||||
@@ -359,7 +358,7 @@ std::tuple<bool, int> GlyphVector::regenerateAtlasForGraphite(int begin,
|
||||
|
||||
uint64_t currentAtlasGen = atlasManager->atlasGeneration(maskFormat);
|
||||
|
||||
- this->packedGlyphIDToGlyph(recorder->priv().strikeCache());
|
||||
+ this->packedGlyphIDToGlyph(recorder->priv().strikeCache(), maskFormat);
|
||||
|
||||
if (fAtlasGeneration != currentAtlasGen) {
|
||||
// Calculate the texture coordinates for the vertexes during first use (fAtlasGeneration
|
||||
@@ -375,9 +374,10 @@ std::tuple<bool, int> GlyphVector::regenerateAtlasForGraphite(int begin,
|
||||
for (const Variant& variant : glyphs) {
|
||||
Glyph* gpuGlyph = variant.glyph;
|
||||
SkASSERT(gpuGlyph != nullptr);
|
||||
-
|
||||
+ SkASSERT(gpuGlyph->fGlyphEntryKey.fFormat == maskFormat);
|
||||
if (!atlasManager->hasGlyph(maskFormat, gpuGlyph)) {
|
||||
- const SkGlyph& skGlyph = *metricsAndImages.glyph(gpuGlyph->fPackedID);
|
||||
+ const SkGlyph& skGlyph =
|
||||
+ *metricsAndImages.glyph(gpuGlyph->fGlyphEntryKey.fPackedID);
|
||||
auto code = atlasManager->addGlyphToAtlas(skGlyph, gpuGlyph, srcPadding);
|
||||
if (code != DrawAtlas::ErrorCode::kSucceeded) {
|
||||
success = code != DrawAtlas::ErrorCode::kError;
|
||||
diff --git a/src/text/gpu/Glyph.h b/src/text/gpu/Glyph.h
|
||||
index 821612d68cecfe9dae9518e376e09fdf233395ad..7942006a563bcab925ea2129ab6f6beea438a4c8 100644
|
||||
--- a/src/text/gpu/Glyph.h
|
||||
+++ b/src/text/gpu/Glyph.h
|
||||
@@ -14,6 +14,25 @@
|
||||
|
||||
namespace sktext::gpu {
|
||||
|
||||
+struct GlyphEntryKey {
|
||||
+ explicit GlyphEntryKey(SkPackedGlyphID id, skgpu::MaskFormat format)
|
||||
+ : fPackedID(id), fFormat(format) {}
|
||||
+
|
||||
+ const SkPackedGlyphID fPackedID;
|
||||
+ skgpu::MaskFormat fFormat;
|
||||
+
|
||||
+ bool operator==(const GlyphEntryKey& that) const {
|
||||
+ return fPackedID == that.fPackedID && fFormat == that.fFormat;
|
||||
+ }
|
||||
+ bool operator!=(const GlyphEntryKey& that) const {
|
||||
+ return !(*this == that);
|
||||
+ }
|
||||
+
|
||||
+ uint32_t hash() const {
|
||||
+ return fPackedID.hash();
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
class Glyph {
|
||||
public:
|
||||
static skgpu::MaskFormat FormatFromSkGlyph(SkMask::Format format) {
|
||||
@@ -34,10 +53,11 @@ public:
|
||||
SkUNREACHABLE;
|
||||
}
|
||||
|
||||
- explicit Glyph(SkPackedGlyphID packedGlyphID) : fPackedID(packedGlyphID) {}
|
||||
+ explicit Glyph(SkPackedGlyphID packedGlyphID, skgpu::MaskFormat format)
|
||||
+ : fGlyphEntryKey(packedGlyphID, format) {}
|
||||
|
||||
- const SkPackedGlyphID fPackedID;
|
||||
- skgpu::AtlasLocator fAtlasLocator;
|
||||
+ const GlyphEntryKey fGlyphEntryKey;
|
||||
+ skgpu::AtlasLocator fAtlasLocator;
|
||||
};
|
||||
|
||||
} // namespace sktext::gpu
|
||||
diff --git a/src/text/gpu/GlyphVector.cpp b/src/text/gpu/GlyphVector.cpp
|
||||
index 2a8e85f926aa547169f4b85372e9d3fb99816956..7bec7a0b77d8560d5ef978281edd7df6c45cb56f 100644
|
||||
--- a/src/text/gpu/GlyphVector.cpp
|
||||
+++ b/src/text/gpu/GlyphVector.cpp
|
||||
@@ -99,14 +99,14 @@ SkSpan<const Glyph*> GlyphVector::glyphs() const {
|
||||
|
||||
// packedGlyphIDToGlyph must be run in single-threaded mode.
|
||||
// If fSkStrike is not sk_sp<SkStrike> then the conversion to Glyph* has not happened.
|
||||
-void GlyphVector::packedGlyphIDToGlyph(StrikeCache* cache) {
|
||||
+void GlyphVector::packedGlyphIDToGlyph(StrikeCache* cache, MaskFormat maskFormat) {
|
||||
if (fTextStrike == nullptr) {
|
||||
SkStrike* strike = fStrikePromise.strike();
|
||||
fTextStrike = cache->findOrCreateStrike(strike->strikeSpec());
|
||||
|
||||
// Get all the atlas locations for each glyph.
|
||||
for (Variant& variant : fGlyphs) {
|
||||
- variant.glyph = fTextStrike->getGlyph(variant.packedGlyphID);
|
||||
+ variant.glyph = fTextStrike->getGlyph(variant.packedGlyphID, maskFormat);
|
||||
}
|
||||
|
||||
// This must be pinned for the Atlas filling to work.
|
||||
diff --git a/src/text/gpu/GlyphVector.h b/src/text/gpu/GlyphVector.h
|
||||
index 42b92a93f70cc6d86d0a87dd07c2244e0da1281c..1eec6327d38fb4472b027faae68eecb9ad7509d7 100644
|
||||
--- a/src/text/gpu/GlyphVector.h
|
||||
+++ b/src/text/gpu/GlyphVector.h
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
// the sub runs.
|
||||
int unflattenSize() const { return GlyphVectorSize(fGlyphs.size()); }
|
||||
|
||||
- void packedGlyphIDToGlyph(StrikeCache* cache);
|
||||
+ void packedGlyphIDToGlyph(StrikeCache* cache, skgpu::MaskFormat);
|
||||
|
||||
static size_t GlyphVectorSize(size_t count) {
|
||||
return sizeof(Variant) * count;
|
||||
diff --git a/src/text/gpu/StrikeCache.cpp b/src/text/gpu/StrikeCache.cpp
|
||||
index add3127c92fdbfe56d6b56209a2235ce5a9f5acb..19df48329fd500f8682669ec96eb883b58243fdd 100644
|
||||
--- a/src/text/gpu/StrikeCache.cpp
|
||||
+++ b/src/text/gpu/StrikeCache.cpp
|
||||
@@ -207,10 +207,11 @@ TextStrike::TextStrike(StrikeCache* strikeCache, const SkStrikeSpec& strikeSpec)
|
||||
: fStrikeCache(strikeCache)
|
||||
, fStrikeSpec{strikeSpec} {}
|
||||
|
||||
-Glyph* TextStrike::getGlyph(SkPackedGlyphID packedGlyphID) {
|
||||
- Glyph* glyph = fCache.findOrNull(packedGlyphID);
|
||||
+Glyph* TextStrike::getGlyph(SkPackedGlyphID packedGlyphID, skgpu::MaskFormat format) {
|
||||
+ GlyphEntryKey localKey(packedGlyphID, format);
|
||||
+ Glyph* glyph = fCache.findOrNull(localKey);
|
||||
if (glyph == nullptr) {
|
||||
- glyph = fAlloc.make<Glyph>(packedGlyphID);
|
||||
+ glyph = fAlloc.make<Glyph>(packedGlyphID, format);
|
||||
fCache.set(glyph);
|
||||
fMemoryUsed += sizeof(Glyph);
|
||||
if (!fRemoved) {
|
||||
@@ -220,11 +221,11 @@ Glyph* TextStrike::getGlyph(SkPackedGlyphID packedGlyphID) {
|
||||
return glyph;
|
||||
}
|
||||
|
||||
-const SkPackedGlyphID& TextStrike::HashTraits::GetKey(const Glyph* glyph) {
|
||||
- return glyph->fPackedID;
|
||||
+const GlyphEntryKey& TextStrike::HashTraits::GetKey(const Glyph* glyph) {
|
||||
+ return glyph->fGlyphEntryKey;
|
||||
}
|
||||
|
||||
-uint32_t TextStrike::HashTraits::Hash(SkPackedGlyphID key) {
|
||||
+uint32_t TextStrike::HashTraits::Hash(GlyphEntryKey key) {
|
||||
return key.hash();
|
||||
}
|
||||
|
||||
diff --git a/src/text/gpu/StrikeCache.h b/src/text/gpu/StrikeCache.h
|
||||
index 007c45c6c6feecba3ff031ba3939ad2402e082b9..014afd5286602e3e049d8e48ae328273e599dc41 100644
|
||||
--- a/src/text/gpu/StrikeCache.h
|
||||
+++ b/src/text/gpu/StrikeCache.h
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "src/core/SkDescriptor.h"
|
||||
#include "src/core/SkStrikeSpec.h"
|
||||
#include "src/core/SkTHash.h"
|
||||
+#include "src/gpu/AtlasTypes.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
@@ -32,6 +33,7 @@ struct SkPackedGlyphID;
|
||||
namespace sktext::gpu {
|
||||
|
||||
class Glyph;
|
||||
+struct GlyphEntryKey;
|
||||
class StrikeCache;
|
||||
|
||||
// The TextStrike manages an SkArenaAlloc for Glyphs. The SkStrike is what actually creates
|
||||
@@ -43,7 +45,7 @@ public:
|
||||
TextStrike(StrikeCache* strikeCache,
|
||||
const SkStrikeSpec& strikeSpec);
|
||||
|
||||
- Glyph* getGlyph(SkPackedGlyphID);
|
||||
+ Glyph* getGlyph(SkPackedGlyphID, skgpu::MaskFormat format);
|
||||
const SkStrikeSpec& strikeSpec() const { return fStrikeSpec; }
|
||||
const SkDescriptor& getDescriptor() const { return fStrikeSpec.descriptor(); }
|
||||
|
||||
@@ -54,11 +56,11 @@ private:
|
||||
const SkStrikeSpec fStrikeSpec;
|
||||
|
||||
struct HashTraits {
|
||||
- static const SkPackedGlyphID& GetKey(const Glyph* glyph);
|
||||
- static uint32_t Hash(SkPackedGlyphID key);
|
||||
+ static const GlyphEntryKey& GetKey(const Glyph* glyph);
|
||||
+ static uint32_t Hash(GlyphEntryKey key);
|
||||
};
|
||||
// Map SkPackedGlyphID -> Glyph*.
|
||||
- skia_private::THashTable<Glyph*, SkPackedGlyphID, HashTraits> fCache;
|
||||
+ skia_private::THashTable<Glyph*, GlyphEntryKey, HashTraits> fCache;
|
||||
|
||||
// Store for the glyph information.
|
||||
SkArenaAlloc fAlloc{512};
|
||||
diff --git a/src/text/gpu/SubRunContainer.cpp b/src/text/gpu/SubRunContainer.cpp
|
||||
index 3a061a2012cd99de9ee4b3674f78ae99e0385d6c..a19460c82593c6713c047ab19e71caa27e375a6d 100644
|
||||
--- a/src/text/gpu/SubRunContainer.cpp
|
||||
+++ b/src/text/gpu/SubRunContainer.cpp
|
||||
@@ -651,8 +651,9 @@ public:
|
||||
|
||||
int glyphSrcPadding() const override { return 0; }
|
||||
|
||||
- void testingOnly_packedGlyphIDToGlyph(StrikeCache* cache) const override {
|
||||
- fGlyphs.packedGlyphIDToGlyph(cache);
|
||||
+ void testingOnly_packedGlyphIDToGlyph(StrikeCache* cache,
|
||||
+ skgpu::MaskFormat maskFormat) const override {
|
||||
+ fGlyphs.packedGlyphIDToGlyph(cache, maskFormat);
|
||||
}
|
||||
|
||||
std::tuple<bool, SkRect> deviceRectAndNeedsTransform(
|
||||
@@ -755,8 +756,9 @@ public:
|
||||
|
||||
const AtlasSubRun* testingOnly_atlasSubRun() const override { return this; }
|
||||
|
||||
- void testingOnly_packedGlyphIDToGlyph(StrikeCache *cache) const override {
|
||||
- fGlyphs.packedGlyphIDToGlyph(cache);
|
||||
+ void testingOnly_packedGlyphIDToGlyph(StrikeCache *cache,
|
||||
+ skgpu::MaskFormat maskFormat) const override {
|
||||
+ fGlyphs.packedGlyphIDToGlyph(cache, maskFormat);
|
||||
}
|
||||
|
||||
int glyphSrcPadding() const override { return 1; }
|
||||
@@ -884,8 +886,9 @@ public:
|
||||
|
||||
const AtlasSubRun* testingOnly_atlasSubRun() const override { return this; }
|
||||
|
||||
- void testingOnly_packedGlyphIDToGlyph(StrikeCache *cache) const override {
|
||||
- fGlyphs.packedGlyphIDToGlyph(cache);
|
||||
+ void testingOnly_packedGlyphIDToGlyph(StrikeCache *cache,
|
||||
+ skgpu::MaskFormat maskFormat) const override {
|
||||
+ fGlyphs.packedGlyphIDToGlyph(cache, maskFormat);
|
||||
}
|
||||
|
||||
int glyphSrcPadding() const override { return SK_DistanceFieldInset; }
|
||||
diff --git a/src/text/gpu/SubRunContainer.h b/src/text/gpu/SubRunContainer.h
|
||||
index 2573dbb3964e9ab2cc0e276b60d4ab4f9804f0d9..4d1a3c8c2d55015d3d351d322ef039c45be2a398 100644
|
||||
--- a/src/text/gpu/SubRunContainer.h
|
||||
+++ b/src/text/gpu/SubRunContainer.h
|
||||
@@ -167,7 +167,7 @@ public:
|
||||
|
||||
const VertexFiller& vertexFiller() const { return fVertexFiller; }
|
||||
|
||||
- virtual void testingOnly_packedGlyphIDToGlyph(StrikeCache* cache) const = 0;
|
||||
+ virtual void testingOnly_packedGlyphIDToGlyph(StrikeCache* cache, skgpu::MaskFormat) const = 0;
|
||||
|
||||
protected:
|
||||
const VertexFiller fVertexFiller;
|
||||
diff --git a/tests/AtlasOobTest.cpp b/tests/AtlasOobTest.cpp
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4e6fb02ee6af6543df285d8112f1a2ced5bd9ac9
|
||||
--- /dev/null
|
||||
+++ b/tests/AtlasOobTest.cpp
|
||||
@@ -0,0 +1,201 @@
|
||||
+/*
|
||||
+ * Copyright 2026 Google LLC
|
||||
+ *
|
||||
+ * Use of this source code is governed by a BSD-style license that can be
|
||||
+ * found in the LICENSE file.
|
||||
+ */
|
||||
+#include "include/core/SkCanvas.h"
|
||||
+#include "include/core/SkGraphics.h"
|
||||
+#include "include/core/SkSerialProcs.h"
|
||||
+#include "include/core/SkSurface.h"
|
||||
+#include "include/private/chromium/SkChromeRemoteGlyphCache.h"
|
||||
+#include "include/private/chromium/Slug.h"
|
||||
+#include "src/core/SkDescriptor.h"
|
||||
+#include "src/core/SkReadBuffer.h"
|
||||
+#include "src/core/SkTypeface_remote.h"
|
||||
+#include "src/core/SkWriteBuffer.h"
|
||||
+#include "src/gpu/AtlasTypes.h"
|
||||
+#include "tests/CtsEnforcement.h"
|
||||
+#include "tests/Test.h"
|
||||
+#include "tools/ToolUtils.h"
|
||||
+
|
||||
+#if defined(SK_GANESH)
|
||||
+#include "include/gpu/ganesh/GrDirectContext.h"
|
||||
+#include "include/gpu/ganesh/SkSurfaceGanesh.h"
|
||||
+#endif
|
||||
+
|
||||
+#if defined(SK_GRAPHITE)
|
||||
+#include "include/gpu/graphite/Context.h"
|
||||
+#include "include/gpu/graphite/Surface.h"
|
||||
+#include "tools/graphite/GraphiteTestContext.h"
|
||||
+#endif // defined(SK_GRAPHITE)
|
||||
+
|
||||
+#include <vector>
|
||||
+#include <cstring>
|
||||
+
|
||||
+namespace {
|
||||
+class FakeDiscardableManager : public SkStrikeClient::DiscardableHandleManager {
|
||||
+public:
|
||||
+ bool deleteHandle(SkDiscardableHandleId) override { return false; }
|
||||
+ void notifyCacheMiss(SkStrikeClient::CacheMissType, int) override {}
|
||||
+ void notifyReadFailure(const ReadFailureData&) override {}
|
||||
+ void assertHandleValid(SkDiscardableHandleId) override {}
|
||||
+};
|
||||
+
|
||||
+unsigned char kStrikeData[] = {
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x07, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65,
|
||||
+ 0x00, 0x00, 0x00, 0x65, 0xd8, 0x50, 0xda, 0x99, 0x4c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
+ 0x63, 0x65, 0x72, 0x73, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x80, 0x41,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x41,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
+ 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x41, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x41, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x64, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x20, 0x41, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x41,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
+ 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x41, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x41, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x66, 0x86, 0x07, 0xc2, 0x42,
|
||||
+ 0x4c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x63, 0x65, 0x72, 0x73, 0x38, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
+ 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x41, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00
|
||||
+};
|
||||
+
|
||||
+unsigned char kDrawSlugOp[] = {
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x41,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41,
|
||||
+ 0x00, 0x00, 0x00, 0x41, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x86, 0x07, 0xc2, 0x42, 0x4c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x63, 0x65, 0x72, 0x73,
|
||||
+ 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
+ 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
+};
|
||||
+
|
||||
+} // namespace
|
||||
+
|
||||
+// TODO: We expect this test to correctly hit an SkUnreachable and then crash. That does not work
|
||||
+// with our current testing framework because we have no to "expect" a crash. So for now we will
|
||||
+// land this test with only the valid loop enabled, but to test this is working locally, you should
|
||||
+// change the loop to have both iterations.
|
||||
+static void run_atlas_oob_test(skiatest::Reporter* reporter, SkCanvas* canvas) {
|
||||
+ auto discardableManager = sk_make_sp<FakeDiscardableManager>();
|
||||
+ SkStrikeClient client(discardableManager, false);
|
||||
+
|
||||
+ // 1. Prepare Strike Data
|
||||
+ if (!client.readStrikeData(kStrikeData, sizeof(kStrikeData))) {
|
||||
+ REPORTER_ASSERT(reporter, false, "Failed to read initial strike data");
|
||||
+ }
|
||||
+
|
||||
+ // 2. Prepare and Execute DrawSlug ops
|
||||
+ SkPaint paint;
|
||||
+ for (int idx = 0; idx < 1; ++idx) {
|
||||
+// for (int idx = 0; idx < 2; ++idx) {
|
||||
+ if (idx == 0) {
|
||||
+ kDrawSlugOp[0x48] = (unsigned char)skgpu::MaskFormat::kARGB;
|
||||
+ } else if (idx == 1) {
|
||||
+ kDrawSlugOp[0x48] = (unsigned char)skgpu::MaskFormat::kA8;
|
||||
+ }
|
||||
+ kDrawSlugOp[0xd8] = SkMask::kARGB32_Format;
|
||||
+ kDrawSlugOp[0xe0] = 0x99;
|
||||
+
|
||||
+ auto slug = client.deserializeSlugForTest(kDrawSlugOp, sizeof(kDrawSlugOp));
|
||||
+ if (slug) {
|
||||
+ slug->draw(canvas, paint);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
+
|
||||
+#if defined(SK_GANESH)
|
||||
+DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(Atlas_Oob_ganesh, reporter, ctxInfo, CtsEnforcement::kNextRelease) {
|
||||
+ auto dContext = ctxInfo.directContext();
|
||||
+ SkImageInfo info = SkImageInfo::MakeN32Premul(1024, 1024);
|
||||
+ auto surface = SkSurfaces::RenderTarget(dContext, skgpu::Budgeted::kNo, info);
|
||||
+ if (!surface) return;
|
||||
+ auto canvas = surface->getCanvas();
|
||||
+
|
||||
+ run_atlas_oob_test(reporter, canvas);
|
||||
+
|
||||
+ dContext->flushAndSubmit();
|
||||
+}
|
||||
+#endif // defined(SK_GANESH)
|
||||
+
|
||||
+#if defined(SK_GRAPHITE)
|
||||
+DEF_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS(Atlas_Oob_graphite, reporter, context, CtsEnforcement::kNextRelease) {
|
||||
+ using namespace skgpu::graphite;
|
||||
+ std::unique_ptr<Recorder> recorder = context->makeRecorder();
|
||||
+ SkImageInfo info = SkImageInfo::MakeN32Premul(1024, 1024);
|
||||
+ auto surface = SkSurfaces::RenderTarget(recorder.get(), info);
|
||||
+ if (!surface) return;
|
||||
+ auto canvas = surface->getCanvas();
|
||||
+
|
||||
+ run_atlas_oob_test(reporter, canvas);
|
||||
+
|
||||
+ std::unique_ptr<Recording> recording = recorder->snap();
|
||||
+ InsertRecordingInfo recordingInfo;
|
||||
+ recordingInfo.fRecording = recording.get();
|
||||
+ context->insertRecording(recordingInfo);
|
||||
+ context->submit();
|
||||
+}
|
||||
+#endif // defined(SK_GRAPHITE)
|
||||
@@ -1 +1,2 @@
|
||||
chore_allow_customizing_microtask_policy_per_context.patch
|
||||
cherry-pick-d5b0cb2acffe.patch
|
||||
|
||||
50
patches/v8/cherry-pick-d5b0cb2acffe.patch
Normal file
50
patches/v8/cherry-pick-d5b0cb2acffe.patch
Normal file
@@ -0,0 +1,50 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Darius Mercadier <dmercadier@chromium.org>
|
||||
Date: Wed, 25 Feb 2026 12:56:18 +0100
|
||||
Subject: [M144 Merge] [maglev] fix CanElideWriteBarrier Smi recording for phis
|
||||
|
||||
Recording a Tagged use is not enough for 2 reasons:
|
||||
|
||||
* Tagged uses are sometimes ignored, in particular for loop phis
|
||||
where we distinguish in-loop and out-of-loop uses.
|
||||
|
||||
* This Tagged use could only prevent untagging of this specific phi,
|
||||
but none of its inputs. So we could have a Smi phi as input to the
|
||||
current phi which gets untagged and retagged to a non-Smi, all
|
||||
while the current phi doesn't get untagged.
|
||||
|
||||
(cherry picked from commit a54bf5cd45e5b119e2afe6019428e81c3d626fb3)
|
||||
|
||||
Change-Id: I9b3a2ea339f2c9d81dbb74a44425ba55d8c73871
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7604255
|
||||
Auto-Submit: Darius Mercadier <dmercadier@chromium.org>
|
||||
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
|
||||
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
|
||||
Cr-Original-Commit-Position: refs/heads/main@{#105444}
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7659106
|
||||
Auto-Submit: Srinivas Sista <srinivassista@chromium.org>
|
||||
Reviewed-by: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
|
||||
Commit-Queue: Srinivas Sista <srinivassista@chromium.org>
|
||||
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
|
||||
Owners-Override: Srinivas Sista <srinivassista@chromium.org>
|
||||
Cr-Commit-Position: refs/branch-heads/14.4@{#64}
|
||||
Cr-Branched-From: 80acc26727d5a34e77dabeebe7c9213ec1bd4768-refs/heads/14.4.258@{#1}
|
||||
Cr-Branched-From: ce7e597e90f6df3fa4b6df224bc613b80c635450-refs/heads/main@{#104020}
|
||||
|
||||
diff --git a/src/maglev/maglev-graph-builder.cc b/src/maglev/maglev-graph-builder.cc
|
||||
index bf6a5ab1b41d684c37dd96f7720474c6bb71a4db..c21a41d7da3394bb8f35857e0dcf49a78b218d31 100644
|
||||
--- a/src/maglev/maglev-graph-builder.cc
|
||||
+++ b/src/maglev/maglev-graph-builder.cc
|
||||
@@ -4439,7 +4439,11 @@ bool MaglevGraphBuilder::CanElideWriteBarrier(ValueNode* object,
|
||||
ValueNode* value) {
|
||||
if (value->Is<RootConstant>() || value->Is<ConsStringMap>()) return true;
|
||||
if (!IsEmptyNodeType(GetType(value)) && CheckType(value, NodeType::kSmi)) {
|
||||
- value->MaybeRecordUseReprHint(UseRepresentation::kTagged);
|
||||
+ if constexpr (SmiValuesAre31Bits()) {
|
||||
+ if (Phi* value_as_phi = value->TryCast<Phi>()) {
|
||||
+ value_as_phi->SetUseRequires31BitValue();
|
||||
+ }
|
||||
+ }
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ const args = minimist(process.argv.slice(2), {
|
||||
|
||||
const BASE = path.resolve(__dirname, '../..');
|
||||
|
||||
const ROOT_PACKAGE_JSON = path.resolve(BASE, 'package.json');
|
||||
const NODE_DIR = path.resolve(BASE, 'third_party', 'electron_node');
|
||||
const JUNIT_DIR = args.jUnitDir ? path.resolve(args.jUnitDir) : null;
|
||||
const TAP_FILE_NAME = 'test.tap';
|
||||
@@ -38,6 +39,18 @@ const defaultOptions = [
|
||||
'-J'
|
||||
];
|
||||
|
||||
// The root package.json is ESM, which breaks the test runner.
|
||||
// Temporarily change it to CommonJS while running the tests, then
|
||||
// change it back when done.
|
||||
const resetPackageJson = ({ useESM }) => {
|
||||
// This won't always exist in CI.
|
||||
if (!fs.existsSync(ROOT_PACKAGE_JSON)) { return; }
|
||||
|
||||
const packageJson = JSON.parse(fs.readFileSync(ROOT_PACKAGE_JSON, 'utf-8'));
|
||||
packageJson.type = useESM ? 'module' : 'commonjs';
|
||||
fs.writeFileSync(ROOT_PACKAGE_JSON, JSON.stringify(packageJson, null, 2) + '\n');
|
||||
};
|
||||
|
||||
const getCustomOptions = () => {
|
||||
let customOptions = ['tools/test.py'];
|
||||
|
||||
@@ -79,6 +92,8 @@ async function main () {
|
||||
|
||||
const options = args.default ? defaultOptions : getCustomOptions();
|
||||
|
||||
resetPackageJson({ useESM: false });
|
||||
|
||||
const testChild = cp.spawn('python3', options, {
|
||||
env: {
|
||||
...process.env,
|
||||
@@ -88,7 +103,10 @@ async function main () {
|
||||
cwd: NODE_DIR,
|
||||
stdio: 'inherit'
|
||||
});
|
||||
|
||||
testChild.on('exit', (testCode) => {
|
||||
resetPackageJson({ useESM: true });
|
||||
|
||||
if (JUNIT_DIR) {
|
||||
fs.mkdirSync(JUNIT_DIR);
|
||||
const converterStream = require('tap-xunit')();
|
||||
|
||||
@@ -999,17 +999,13 @@ void NativeWindowViews::MoveTop() {
|
||||
|
||||
bool NativeWindowViews::CanResize() const {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
return resizable_ && thick_frame_;
|
||||
return has_frame() ? resizable_ && thick_frame_ : resizable_;
|
||||
#else
|
||||
return resizable_;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NativeWindowViews::IsResizable() const {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
if (has_frame())
|
||||
return ::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME;
|
||||
#endif
|
||||
return CanResize();
|
||||
}
|
||||
|
||||
|
||||
@@ -5522,7 +5522,7 @@ describe('BrowserWindow module', () => {
|
||||
thickFrame: true,
|
||||
transparent: true
|
||||
});
|
||||
expect(w.isResizable()).to.be.false('resizable');
|
||||
expect(w.isResizable()).to.be.true('resizable');
|
||||
w.maximize();
|
||||
expect(w.isMaximized()).to.be.true('maximized');
|
||||
const bounds = w.getBounds();
|
||||
|
||||
@@ -407,6 +407,41 @@ describe('asar package', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('fs.cpSync', function () {
|
||||
itremote('copies a normal file', function () {
|
||||
if (!fs.cpSync) return;
|
||||
const p = path.join(asarDir, 'a.asar', 'file1');
|
||||
const temp = require('temp').track();
|
||||
const dest = temp.path();
|
||||
fs.cpSync(p, dest);
|
||||
expect(fs.readFileSync(p).equals(fs.readFileSync(dest))).to.be.true();
|
||||
});
|
||||
});
|
||||
|
||||
describe('fs.cp', function () {
|
||||
itremote('copies a normal file', async function () {
|
||||
if (!fs.cp) return;
|
||||
const p = path.join(asarDir, 'a.asar', 'file1');
|
||||
const temp = require('temp').track();
|
||||
const dest = temp.path();
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
fs.cp(p, dest, (err) => err ? reject(err) : resolve());
|
||||
});
|
||||
expect(fs.readFileSync(p).equals(fs.readFileSync(dest))).to.be.true();
|
||||
});
|
||||
});
|
||||
|
||||
describe('fs.promises.cp', function () {
|
||||
itremote('copies a normal file', async function () {
|
||||
if (!fs.promises.cp) return;
|
||||
const p = path.join(asarDir, 'a.asar', 'file1');
|
||||
const temp = require('temp').track();
|
||||
const dest = temp.path();
|
||||
await fs.promises.cp(p, dest);
|
||||
expect(fs.readFileSync(p).equals(fs.readFileSync(dest))).to.be.true();
|
||||
});
|
||||
});
|
||||
|
||||
describe('fs.lstatSync', function () {
|
||||
itremote('handles path with trailing slash correctly', function () {
|
||||
const p = path.join(asarDir, 'a.asar', 'link2', 'link2', 'file1');
|
||||
|
||||
Reference in New Issue
Block a user