Commit be89e344 authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

[jumbo] Give two GetDelegate/GetDelegateWrapper methods unique names

In jumbo builds whole chunks of the code is compiled in the same
translation unit, using the same anonymous namespace. If two
files use the same symbol names they will then clash and that
happened in chrome/browser/extensions between
active_tab_permission_granter.cc and extension_tab_util.cc.

This patch renames GetDelegate() and GetDelegateWrapper to include
the more exact names of the Delegate type, making them unique.

Bug: 865947
Change-Id: I46426e8dee715d57acaa3d2385e6dd5b6ac38cf1
Reviewed-on: https://chromium-review.googlesource.com/1219246
Commit-Queue: Daniel Bratell <bratell@opera.com>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590327}
parent ce920507
......@@ -73,23 +73,25 @@ void SendMessageToProcesses(
tab_process->Send(create_message.Run(false));
}
std::unique_ptr<ActiveTabPermissionGranter::Delegate>& GetDelegateWrapper() {
std::unique_ptr<ActiveTabPermissionGranter::Delegate>&
GetActiveTabPermissionGranterDelegateWrapper() {
static base::NoDestructor<
std::unique_ptr<ActiveTabPermissionGranter::Delegate>>
delegate_wrapper;
return *delegate_wrapper;
}
ActiveTabPermissionGranter::Delegate* GetDelegate() {
return GetDelegateWrapper().get();
ActiveTabPermissionGranter::Delegate* GetActiveTabPermissionGranterDelegate() {
return GetActiveTabPermissionGranterDelegateWrapper().get();
}
// Returns true if activeTab is allowed to be granted to the extension. This can
// return false for platform-specific implementations.
bool ShouldGrantActiveTabOrPrompt(const Extension* extension,
content::WebContents* web_contents) {
return !GetDelegate() ||
GetDelegate()->ShouldGrantActiveTabOrPrompt(extension, web_contents);
return !GetActiveTabPermissionGranterDelegate() ||
GetActiveTabPermissionGranterDelegate()->ShouldGrantActiveTabOrPrompt(
extension, web_contents);
}
} // namespace
......@@ -109,7 +111,7 @@ ActiveTabPermissionGranter::~ActiveTabPermissionGranter() {}
// static
void ActiveTabPermissionGranter::SetPlatformDelegate(
std::unique_ptr<Delegate> delegate) {
GetDelegateWrapper() = std::move(delegate);
GetActiveTabPermissionGranterDelegateWrapper() = std::move(delegate);
}
void ActiveTabPermissionGranter::GrantIfRequested(const Extension* extension) {
......
......@@ -106,14 +106,15 @@ int GetTabIdForExtensions(const WebContents* web_contents) {
return SessionTabHelper::IdForTab(web_contents).id();
}
std::unique_ptr<ExtensionTabUtil::Delegate>& GetDelegateWrapper() {
std::unique_ptr<ExtensionTabUtil::Delegate>&
GetExtensionTabUtilDelegateWrapper() {
static base::NoDestructor<std::unique_ptr<ExtensionTabUtil::Delegate>>
delegate_wrapper;
return *delegate_wrapper;
}
ExtensionTabUtil::Delegate* GetDelegate() {
return GetDelegateWrapper().get();
ExtensionTabUtil::Delegate* GetExtensionTabUtilDelegate() {
return GetExtensionTabUtilDelegateWrapper().get();
}
} // namespace
......@@ -500,7 +501,7 @@ std::unique_ptr<api::tabs::MutedInfo> ExtensionTabUtil::CreateMutedInfo(
// static
void ExtensionTabUtil::SetPlatformDelegate(std::unique_ptr<Delegate> delegate) {
GetDelegateWrapper() = std::move(delegate);
GetExtensionTabUtilDelegateWrapper() = std::move(delegate);
}
// static
......@@ -530,8 +531,10 @@ void ExtensionTabUtil::ScrubTabForExtension(const Extension* extension,
tab->title.reset();
tab->fav_icon_url.reset();
}
if (GetDelegate())
GetDelegate()->ScrubTabForExtension(extension, contents, tab);
if (GetExtensionTabUtilDelegate()) {
GetExtensionTabUtilDelegate()->ScrubTabForExtension(extension, contents,
tab);
}
}
bool ExtensionTabUtil::GetTabStripModel(const WebContents* web_contents,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment