Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: cherry-pick 56de3b2004, bbca3704f9 and f2b0985ac3 from chromium (
#31919) Co-authored-by: Electron Bot <electron@github.com>
- Loading branch information
1 parent
56e08fe
commit 098a118
Showing
4 changed files
with
396 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
patches/chromium/allow_null_skbitmap_to_be_transferred_across_threads.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Yutaka Hirano <yhirano@chromium.org> | ||
Date: Tue, 9 Nov 2021 09:03:17 +0000 | ||
Subject: Allow null SkBitmap to be transferred across threads | ||
|
||
(cherry picked from commit dad0c0e5162bcc49b8f60354d3bca92224d8381b) | ||
|
||
Bug: 1241091 | ||
Change-Id: Ie96932c14c8884d6d3eafa76dab5043e7aa31888 | ||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3251815 | ||
Reviewed-by: Florin Malita <fmalita@chromium.org> | ||
Commit-Queue: Yutaka Hirano <yhirano@chromium.org> | ||
Cr-Original-Commit-Position: refs/heads/main@{#936861} | ||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3268018 | ||
Auto-Submit: Yutaka Hirano <yhirano@chromium.org> | ||
Reviewed-by: Kentaro Hara <haraken@chromium.org> | ||
Commit-Queue: Kentaro Hara <haraken@chromium.org> | ||
Cr-Commit-Position: refs/branch-heads/4664@{#893} | ||
Cr-Branched-From: 24dc4ee75e01a29d390d43c9c264372a169273a7-refs/heads/main@{#929512} | ||
|
||
diff --git a/third_party/blink/renderer/platform/graphics/skia/skia_utils.h b/third_party/blink/renderer/platform/graphics/skia/skia_utils.h | ||
index e4bde78252c90ecd19655e8c552a2a39299dff75..33d6a1f115c606c3f203b37642ad2875bcca1dd7 100644 | ||
--- a/third_party/blink/renderer/platform/graphics/skia/skia_utils.h | ||
+++ b/third_party/blink/renderer/platform/graphics/skia/skia_utils.h | ||
@@ -212,11 +212,13 @@ struct CrossThreadCopier<SkBitmap> { | ||
|
||
using Type = SkBitmap; | ||
static SkBitmap Copy(const SkBitmap& bitmap) { | ||
- CHECK(bitmap.isImmutable()) << "Only immutable bitmaps can be transferred."; | ||
+ CHECK(bitmap.isImmutable() || bitmap.isNull()) | ||
+ << "Only immutable bitmaps can be transferred."; | ||
return bitmap; | ||
} | ||
static SkBitmap Copy(SkBitmap&& bitmap) { | ||
- CHECK(bitmap.isImmutable()) << "Only immutable bitmaps can be transferred."; | ||
+ CHECK(bitmap.isImmutable() || bitmap.isNull()) | ||
+ << "Only immutable bitmaps can be transferred."; | ||
return std::move(bitmap); | ||
} | ||
}; |
62 changes: 62 additions & 0 deletions
62
patches/chromium/introduce_crossthreadcopier_skbitmap.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Yutaka Hirano <yhirano@chromium.org> | ||
Date: Tue, 9 Nov 2021 05:02:50 +0000 | ||
Subject: Introduce CrossThreadCopier<SkBitmap> | ||
|
||
Allow immutable SkBitmap to be transferred across threads. | ||
|
||
(cherry picked from commit fd794ad56432870e462aab9d62e4f059169c1a5f) | ||
|
||
Bug: 1241091 | ||
Change-Id: Ia771893245ef2fc1acb05cd4906d64bf2dd406fe | ||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3244824 | ||
Reviewed-by: danakj <danakj@chromium.org> | ||
Reviewed-by: Florin Malita <fmalita@chromium.org> | ||
Commit-Queue: Yutaka Hirano <yhirano@chromium.org> | ||
Cr-Original-Commit-Position: refs/heads/main@{#936435} | ||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3267808 | ||
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> | ||
Reviewed-by: Kentaro Hara <haraken@chromium.org> | ||
Cr-Commit-Position: refs/branch-heads/4664@{#887} | ||
Cr-Branched-From: 24dc4ee75e01a29d390d43c9c264372a169273a7-refs/heads/main@{#929512} | ||
|
||
diff --git a/third_party/blink/renderer/platform/graphics/skia/skia_utils.h b/third_party/blink/renderer/platform/graphics/skia/skia_utils.h | ||
index 0b3efb14964b44ef0929fe33d37cec154d7410b2..e4bde78252c90ecd19655e8c552a2a39299dff75 100644 | ||
--- a/third_party/blink/renderer/platform/graphics/skia/skia_utils.h | ||
+++ b/third_party/blink/renderer/platform/graphics/skia/skia_utils.h | ||
@@ -39,7 +39,9 @@ | ||
#include "third_party/blink/renderer/platform/graphics/image.h" | ||
#include "third_party/blink/renderer/platform/platform_export.h" | ||
#include "third_party/blink/renderer/platform/transforms/affine_transform.h" | ||
+#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" | ||
#include "third_party/blink/renderer/platform/wtf/math_extras.h" | ||
+#include "third_party/skia/include/core/SkBitmap.h" | ||
#include "third_party/skia/include/core/SkCanvas.h" | ||
#include "third_party/skia/include/core/SkColor.h" | ||
#include "third_party/skia/include/core/SkData.h" | ||
@@ -200,4 +202,25 @@ PLATFORM_EXPORT sk_sp<SkData> TryAllocateSkData(size_t size); | ||
|
||
} // namespace blink | ||
|
||
+namespace WTF { | ||
+ | ||
+// We define CrossThreadCopier<SKBitMap> here because we cannot include skia | ||
+// headers in platform/wtf. | ||
+template <> | ||
+struct CrossThreadCopier<SkBitmap> { | ||
+ STATIC_ONLY(CrossThreadCopier); | ||
+ | ||
+ using Type = SkBitmap; | ||
+ static SkBitmap Copy(const SkBitmap& bitmap) { | ||
+ CHECK(bitmap.isImmutable()) << "Only immutable bitmaps can be transferred."; | ||
+ return bitmap; | ||
+ } | ||
+ static SkBitmap Copy(SkBitmap&& bitmap) { | ||
+ CHECK(bitmap.isImmutable()) << "Only immutable bitmaps can be transferred."; | ||
+ return std::move(bitmap); | ||
+ } | ||
+}; | ||
+ | ||
+} // namespace WTF | ||
+ | ||
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_SKIA_SKIA_UTILS_H_ |
Oops, something went wrong.