Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: stop using std::vector<const uint8_t> in ProcessingSingleton #41832

Merged
merged 3 commits into from Apr 15, 2024

Conversation

selfisekai
Copy link
Contributor

Description of Change

replace std::vector<const uint8_t> with std::vector<uint8_t>

breaks compilation with gcc/libstdc++.
this is in line with https://issues.chromium.org/issues/323708866

Checklist

Release Notes

Notes: none

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Apr 11, 2024
@selfisekai selfisekai changed the title stop using std::vector<const uint8_t> in ProcessingSingleton fix: stop using std::vector<const uint8_t> in ProcessingSingleton Apr 11, 2024
@selfisekai selfisekai marked this pull request as ready for review April 11, 2024 13:42
@selfisekai selfisekai requested a review from a team as a code owner April 11, 2024 13:42
Copy link
Member

@nornagon nornagon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks the build on Windows:

..\..\buildtools\reclient\rewrapper -cfg=..\..\buildtools\reclient_cfgs\chromium-browser-clang\rewrapper_windows.cfg -inputs=build\config\unsafe_buffers_paths.txt -exec_root=C:\projects\src\ -labels=type=compile,compiler=clang-cl,lang=cpp ..\..\third_party\llvm-build\Release+Asserts\bin\clang-cl.exe /c ../../chrome/browser/process_singleton_win.cc /Foobj/electron/chromium_src/chrome/process_singleton_win.obj /nologo /showIncludes:user /winsysroot../../third_party/depot_tools/win_toolchain/vs_files/28622d16b1 -DDCHECK_ALWAYS_ON=1 -DUSE_AURA=1 -D_HAS_NODISCARD -D_CRT_NONSTDC_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE "-DCR_CLANG_REVISION=\"llvmorg-19-init-2941-ga0b3dbaf-22\"" -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DCR_LIBCXX_REVISION=80307e66e74bae927fb8709a549859e777e3bf0b -D__STD_C -D_CRT_RAND_S -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE -D_ATL_NO_OPENGL -D_WINDOWS -DCERT_CHAIN_PARA_HAS_EXTRA_FIELDS -DPSAPI_VERSION=2 -DWIN32 -D_SECURE_ATL -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_UNICODE -DUNICODE -DNTDDI_VERSION=NTDDI_WIN10_NI -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DSK_ENABLE_SKSL -DSK_UNTIL_CRBUG_1187654_IS_FIXED "-DSK_USER_CONFIG_HEADER=\"../../skia/config/SkUserConfig.h\"" -DSK_WIN_FONTMGR_NO_SIMULATIONS -DSK_DISABLE_LEGACY_INIT_DECODERS -DSK_SLUG_DISABLE_LEGACY_DESERIALIZE -DSK_DISABLE_LEGACY_VULKAN_BACKENDSEMAPHORE -DSK_DISABLE_LEGACY_CREATE_CHARACTERIZATION -DSK_DISABLE_LEGACY_VULKAN_MUTABLE_TEXTURE_STATE -DSK_CODEC_DECODES_JPEG -DSK_ENCODE_JPEG -DSK_ENCODE_PNG -DSK_ENCODE_WEBP -DGR_GL_FUNCTION_TYPE=__stdcall -DSK_GANESH "-DSK_GPU_WORKAROUNDS_HEADER=\"gpu/config/gpu_driver_bug_workaround_autogen.h\"" -DSK_GL -DSK_VULKAN=1 -DSK_GRAPHITE -DSK_DAWN -DVK_USE_PLATFORM_WIN32_KHR -DENABLE_IPC_FUZZER -DLIBYUV_DISABLE_NEON -DLIBYUV_DISABLE_LSX -DLIBYUV_DISABLE_LASX -DUSE_EGL -D_WTL_NO_AUTOMATIC_NAMESPACE -DTOOLKIT_VIEWS=1 -DON_FOCUS_PING_ENABLED -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_ENABLE_TRACING=1 -DU_ENABLE_RESOURCE_TRACING=0 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0 -DCRASHPAD_ZLIB_SOURCE_EXTERNAL -DV8_USE_EXTERNAL_STARTUP_DATA -DWEBRTC_ENABLE_AVX2 -DRTC_ENABLE_WIN_WGC -DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0 -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_WIN -DABSL_ALLOCATOR_NOTHROW=1 -DLOGGING_INSIDE_WEBRTC -DLEVELDB_PLATFORM_CHROMIUM=1 -DV8_COMPRESS_POINTERS -DV8_COMPRESS_POINTERS_IN_SHARED_CAGE -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_ENABLE_SANDBOX -DV8_DEPRECATION_WARNINGS -DCPPGC_CAGED_HEAP -DCPPGC_YOUNG_GENERATION -DCPPGC_POINTER_COMPRESSION -DCPPGC_SLIM_WRITE_BARRIER -DENABLE_TRACE_LOGGING -I../.. -Igen -I../../buildtools/third_party/libc++ -I../../third_party/skia -Igen/third_party/skia -I../../third_party/wuffs/src/release/c -I../../third_party/vulkan/include -I../../third_party/vulkan-deps/vulkan-headers/src/include -Igen/third_party/dawn/include -I../../third_party/dawn/include -I../../third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -I../../net/third_party/quiche/overrides -I../../net/third_party/quiche/src/quiche/common/platform/default -I../../net/third_party/quiche/src -I../../third_party/libyuv/include -I../../third_party/khronos -I../../gpu -Igen/third_party/private_membership/src -Igen/third_party/shell-encryption/src -Igen/components/policy/proto -I../../third_party/wtl/include -I../../base/allocator/partition_allocator/src -Igen/base/allocator/partition_allocator/src -I../../third_party/abseil-cpp -I../../third_party/boringssl/src/include -I../../third_party/protobuf/src -Igen/protoc_out -I../../third_party/ipcz/include -I../../third_party/ced/src -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n -Igen/net/third_party/quiche/src -I../../third_party/crashpad/crashpad -I../../third_party/crashpad/crashpad/compat/win -I../../third_party/zlib -I../../third_party/webrtc_overrides -I../../third_party/webrtc -Igen/third_party/webrtc -I../../third_party/libwebm/source -I../../third_party/mesa_headers -I../../third_party/leveldatabase -I../../third_party/leveldatabase/src -I../../third_party/leveldatabase/src/include -I../../third_party/libaom/source/libaom -I../../third_party/libaom/source/config/win/x64 -I../../v8/include -Igen/third_party/metrics_proto -I../../third_party/re2/src -I../../third_party/openscreen/src -Igen/third_party/openscreen/src -I../../third_party/jsoncpp/source/include /W4 -Wimplicit-fallthrough -Wextra-semi -Wunreachable-code-aggressive -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi -Wloop-analysis -Wno-unneeded-internal-declaration -Wno-nonportable-include-path -Wno-ignored-pragma-optimize -Wno-deprecated-builtins -Wno-bitfield-constant-conversion -Wno-deprecated-this-capture -Wno-invalid-offsetof -Wno-vla-extension -Wno-thread-safety-reference-return -Wshadow /WX -fno-delete-null-pointer-checks -fno-ident -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -mllvm -split-threshold-for-reg-with-hint=0 /clang:-ffp-contract=off -fcomplete-member-pointers /Gy /FS /bigobj /utf-8 /Zc:twoPhase -ffile-reproducible /Zc:sizedDealloc- /D__WRL_ENABLE_FUNCTION_STATICS__ -fmsc-version=1934 -m64 -msse3 /Brepro -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -ffile-compilation-dir=. -no-canonical-prefixes -ftrivial-auto-var-init=pattern /O2 /Oy- /Zc:inline /Gw /clang:-fno-math-errno -gno-codeview-command-line -gcodeview-ghash -gline-tables-only /guard:cf /MT -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ref-template-as-trivial-member -Xclang -plugin-arg-find-bad-constructs -Xclang check-stack-allocated -Xclang -plugin-arg-find-bad-constructs -Xclang check-allow-auto-typedefs-better-nested -Xclang -plugin-arg-find-bad-constructs -Xclang check-raw-ptr-to-stack-allocated -Xclang -plugin-arg-find-bad-constructs -Xclang disable-check-raw-ptr-to-stack-allocated-error -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=/third_party/dawn/ -Xclang -plugin-arg-find-bad-constructs -Xclang check-raw-ptr-fields -Xclang -plugin-arg-find-bad-constructs -Xclang check-raw-ref-fields -Xclang -add-plugin -Xclang unsafe-buffers -Xclang -plugin-arg-unsafe-buffers -Xclang ../../build/config/unsafe_buffers_paths.txt -Wno-redundant-parens -Wno-redundant-parens -Wno-null-pointer-subtraction -DPROTOBUF_ALLOW_DEPRECATED=1 -Wenum-compare-conditional -Wno-c++11-narrowing-const-reference /std:c++20 -Wno-trigraphs /TP /GR- -I../../third_party/libc++/src/include /Fd"obj/electron/chromium_src/chrome_cc.pdb"
../../chrome/browser/process_singleton_win.cc(196,35): error: no matching member function for call to 'Run'
  196 |   *result = notification_callback.Run(parsed_command_line,
      |             ~~~~~~~~~~~~~~~~~~~~~~^~~
../..\base/functional/callback.h(335,5): note: candidate function not viable: no known conversion from '__libcpp_remove_reference_t<vector<const unsigned char, allocator<const unsigned char>> &>' (aka 'std::vector<const unsigned char>') to 'std::vector<unsigned char>' for 3rd argument
  335 |   R Run(Args... args) const& {
      |     ^   ~~~~~~~~~~~~
../..\base/functional/callback.h(351,5): note: candidate function not viable: 'this' argument has type 'const ProcessSingleton::NotificationCallback' (aka 'const RepeatingCallback<bool (base::CommandLine, const base::FilePath &, const vector<unsigned char>)>'), but method is not marked const
  351 |   R Run(Args... args) && {
      |     ^
1 error generated.

@clavin clavin added the semver/patch backwards-compatible bug fixes label Apr 12, 2024
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Apr 12, 2024
@brjsp
Copy link
Contributor

brjsp commented Apr 13, 2024

while you're fixing this, could you also change the signatures to not take a vector by value which causes unncecessary copying?

@selfisekai
Copy link
Contributor Author

@brjsp sorry, no, i'm already doing 12 things at a time

@ckerr
Copy link
Member

ckerr commented Apr 15, 2024

while you're fixing this, could you also change the signatures to not take a vector by value which causes unncecessary copying?

I'm not sure it makes sense to make a small perf change like that as an Electron patch to Chromium source; seems like it would be better to upstream that instead

Copy link
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ckerr
Copy link
Member

ckerr commented Apr 15, 2024

@nornagon could you re-review?

@nornagon nornagon merged commit 6aa9a00 into electron:main Apr 15, 2024
18 checks passed
Copy link

release-clerk bot commented Apr 15, 2024

No Release Notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-backport semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants