0
Files
src/net/base/base64.h
Nidhi Jaju 52b25dc66c Use simdutf to base64 decode for data URLs
The simdutf[1] library uses SIMD instructions to accelerate unicode
functions like base64 decoding. This would allow us to speed up
base64 decoding while parsing data URLs.

[1] https://github.com/simdutf/simdutf

Binary-Size: Added the simdutf library.
Fuchsia-Binary-Size: Added the simdutf library.
Bug: 348442535
Change-Id: I88c02dc3e878c5d5ad5e7b2cb0d6593728af5858
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6054817
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Nidhi Jaju <nidhijaju@chromium.org>
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1392020}
2024-12-05 01:31:36 +00:00

28 lines
722 B
C++

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_BASE_BASE64_H_
#define NET_BASE_BASE64_H_
#include <string>
#include "base/base64.h"
#include "net/base/net_export.h"
namespace net {
// Returns true if support for using the simdutf library for base64
// encode/decode is enabled.
bool IsSimdutfBase64SupportEnabled();
// Note: Only safe for use with trustworthy data or in sandboxed processes.
NET_EXPORT bool SimdutfBase64Decode(
std::string_view input,
std::string* output,
base::Base64DecodePolicy policy = base::Base64DecodePolicy::kStrict);
} // namespace net
#endif // NET_BASE_BASE64_H_