fix: misc-use-internal-linkage warnings (#44872)

* refactor: fix misc-use-internal-linkage warnings:

move impl functions into anonymous namespace so that they're not visible
to other compilation units
This commit is contained in:
trop[bot] 2024-11-27 12:35:37 -06:00 committed by GitHub
parent 5ca3f950e9
commit a92b3944a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 54 additions and 14 deletions

View file

@ -200,6 +200,8 @@ struct Converter<blink::WebInputEvent::Modifiers> {
}
};
namespace {
std::vector<std::string_view> ModifiersToArray(int modifiers) {
std::vector<std::string_view> modifier_strings;
@ -210,6 +212,8 @@ std::vector<std::string_view> ModifiersToArray(int modifiers) {
return modifier_strings;
}
} // namespace
blink::WebInputEvent::Type GetWebInputEventType(v8::Isolate* isolate,
v8::Local<v8::Value> val) {
blink::WebInputEvent::Type type = blink::WebInputEvent::Type::kUndefined;
@ -300,6 +304,8 @@ bool Converter<blink::WebKeyboardEvent>::FromV8(v8::Isolate* isolate,
return true;
}
namespace {
int GetKeyLocationCode(const blink::WebInputEvent& key) {
// https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/events/keyboard_event.h;l=46;drc=1ff6437e65b183e673b7b4f25060b74dc2ba5c37
enum KeyLocationCode {
@ -318,6 +324,8 @@ int GetKeyLocationCode(const blink::WebInputEvent& key) {
return kDomKeyLocationStandard;
}
} // namespace
v8::Local<v8::Value> Converter<blink::WebKeyboardEvent>::ToV8(
v8::Isolate* isolate,
const blink::WebKeyboardEvent& in) {

View file

@ -13,6 +13,8 @@
namespace platform_util {
namespace {
struct TrashItemResult {
bool success;
std::string error;
@ -24,6 +26,8 @@ TrashItemResult TrashItemOnBlockingThread(const base::FilePath& full_path) {
return {success, error};
}
} // namespace
void TrashItem(const base::FilePath& full_path,
base::OnceCallback<void(bool, const std::string&)> callback) {
// XXX: is continue_on_shutdown right?

View file

@ -29,6 +29,8 @@
namespace electron::util {
namespace {
struct ScaleFactorPair {
const char* name;
float scale;
@ -55,6 +57,22 @@ float GetScaleFactorFromPath(const base::FilePath& path) {
return 1.0f;
}
bool AddImageSkiaRepFromPath(gfx::ImageSkia* image,
const base::FilePath& path,
double scale_factor) {
std::string file_contents;
{
electron::ScopedAllowBlockingForElectron allow_blocking;
if (!asar::ReadFileToString(path, &file_contents))
return false;
}
return AddImageSkiaRepFromBuffer(image, base::as_byte_span(file_contents), 0,
0, scale_factor);
}
} // namespace
bool AddImageSkiaRepFromPNG(gfx::ImageSkia* image,
const base::span<const uint8_t> data,
double scale_factor) {
@ -114,20 +132,6 @@ bool AddImageSkiaRepFromBuffer(gfx::ImageSkia* image,
return true;
}
bool AddImageSkiaRepFromPath(gfx::ImageSkia* image,
const base::FilePath& path,
double scale_factor) {
std::string file_contents;
{
electron::ScopedAllowBlockingForElectron allow_blocking;
if (!asar::ReadFileToString(path, &file_contents))
return false;
}
return AddImageSkiaRepFromBuffer(image, base::as_byte_span(file_contents), 0,
0, scale_factor);
}
bool PopulateImageSkiaRepsFromPath(gfx::ImageSkia* image,
const base::FilePath& path) {
bool succeed = false;