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

* refactor: misc-use-internal-linkage warnings in context bridge

move impl functions into anonymous namespace so that they're not visible
to other compilation units:

- ExposeAPIInWorld()
- IsCalledFromMainWorld()
- OverrideGlobalPropertyFromIsolatedWorld()
- OverrideGlobalValueFromIsolatedWorld()
- TraceKeyPath()

* refactor: misc-use-internal-linkage warnings in skia util

move impl details into anonymous namespace so that they're not visible
to other compilation units:

- struct ScaleFactorPair
- kScaleFactorPairs[]
- GetScaleFactorFromPath()
- AddImageSkiaRepFromPath()

* refactor: misc-use-internal-linkage warnings in printing util

move impl details into anonymous namespace so that they're not visible
to other compilation units:

- GetFullPagePlugin()

* refactor: misc-use-internal-linkage warnings in blijnk converter

move impl details into anonymous namespace so that they're not visible
to other compilation units:

- GetKeyLocationCode()
- ModifiersToArray()

* refactor: misc-use-internal-linkage warnings in extrension system

move impl details into anonymous namespace so that they're not visible
to other compilation units:

- ParseManifest()

* refactor: misc-use-internal-linkage warnings in skia util

move impl details into anonymous namespace so that they're not visible
to other compilation units:

- GetFrameTokenMap()
- GetFrameTreeNodeIdMap()

* refactor: misc-use-internal-linkage warnings in electron_api_utility_process.cc

move impl details into anonymous namespace so that they're not visible
to other compilation units:

- GetAllUtilityProcessWrappers()

* refactor: misc-use-internal-linkage warnings in electron_api_menu

move impl details into anonymous namespace so that they're not visible
to other compilation units:

- InvokeBoolMethod()

* refactor: misc-use-internal-linkage warnings in platform util

move impl details into anonymous namespace so that they're not visible
to other compilation units:

- struct TrashItemResult
- TrashItemOnBlockingThread()
This commit is contained in:
Charles Kerr 2024-11-27 10:40:39 -06:00 committed by GitHub
parent 4aa1855e39
commit 4a695d07c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 54 additions and 14 deletions

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;