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

* 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:10 -06:00 committed by GitHub
parent f22baeb670
commit 0fe5035395
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 54 additions and 14 deletions

View file

@ -70,6 +70,8 @@ Menu::~Menu() {
}
}
namespace {
bool InvokeBoolMethod(const Menu* menu,
const char* method,
int command_id,
@ -84,6 +86,8 @@ bool InvokeBoolMethod(const Menu* menu,
return gin::ConvertFromV8(isolate, val, &ret) ? ret : default_value;
}
} // namespace
bool Menu::IsCommandIdChecked(int command_id) const {
return InvokeBoolMethod(this, "_isCommandIdChecked", command_id);
}

View file

@ -44,6 +44,8 @@
namespace electron {
namespace {
base::IDMap<api::UtilityProcessWrapper*, base::ProcessId>&
GetAllUtilityProcessWrappers() {
static base::NoDestructor<
@ -52,6 +54,8 @@ GetAllUtilityProcessWrappers() {
return *s_all_utility_process_wrappers;
}
} // namespace
namespace api {
gin::WrapperInfo UtilityProcessWrapper::kWrapperInfo = {

View file

@ -100,6 +100,8 @@ using FrameTreeNodeIdMap = std::unordered_map<content::FrameTreeNodeId,
using FrameTokenMap =
std::map<content::GlobalRenderFrameHostToken, WebFrameMain*>;
namespace {
FrameTreeNodeIdMap& GetFrameTreeNodeIdMap() {
static base::NoDestructor<FrameTreeNodeIdMap> instance;
return *instance;
@ -109,6 +111,8 @@ FrameTokenMap& GetFrameTokenMap() {
return *instance;
}
} // namespace
// static
WebFrameMain* WebFrameMain::FromFrameTreeNodeId(
content::FrameTreeNodeId frame_tree_node_id) {

View file

@ -88,6 +88,8 @@ void ElectronExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
management_policy_ = std::make_unique<ManagementPolicy>();
}
namespace {
std::unique_ptr<base::Value::Dict> ParseManifest(
const std::string_view manifest_contents) {
JSONStringValueDeserializer deserializer(manifest_contents);
@ -101,6 +103,8 @@ std::unique_ptr<base::Value::Dict> ParseManifest(
return std::make_unique<base::Value::Dict>(std::move(*manifest).TakeDict());
}
} // namespace
void ElectronExtensionSystem::LoadComponentExtensions() {
std::string utf8_error;
#if BUILDFLAG(ENABLE_PDF_VIEWER)

View file

@ -79,6 +79,8 @@ bool IsDeviceNameValid(const std::u16string& device_name) {
#endif
}
namespace {
// Duplicated from chrome/browser/printing/print_view_manager_common.cc
content::RenderFrameHost* GetFullPagePlugin(content::WebContents* contents) {
content::RenderFrameHost* full_page_plugin = nullptr;
@ -98,6 +100,8 @@ content::RenderFrameHost* GetFullPagePlugin(content::WebContents* contents) {
return full_page_plugin;
}
} // namespace
// Pick the right RenderFrameHost based on the WebContents.
// Modified from chrome/browser/printing/print_view_manager_common.cc
content::RenderFrameHost* GetRenderFrameHostToUse(