Commit 45e148a1 authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

Avoid having two GetWebContents and GetBrowserClient in content/browser

There are currently two GetWebContents and two GetBrowserClient in
content/browser. In certain non-default extreme jumbo builds
GetWebContents in storage_partition_impl.cc and GetWebContents in
network_service_client.cc could end up in the same
translation unit and it would not compile. There were also
one GetBrowserClient in storage_partition_impl.cc and one in
clear_site_data_throttle.cc

This renames one of the functions
GetWebContents -> GetWebContentsForStoragePartition
and one
GetBrowserContext -> GetBrowserContextFromStoragePartition

Bug: 952723
Change-Id: I85207edde5fcb85eaa6f32cf22ca05a6e324237b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1617837
Auto-Submit: Daniel Bratell <bratell@opera.com>
Commit-Queue: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661348}
parent 883fd8e4
...@@ -272,14 +272,15 @@ void ClearSessionStorageOnUIThread( ...@@ -272,14 +272,15 @@ void ClearSessionStorageOnUIThread(
origin_matcher, perform_storage_cleanup, std::move(callback))); origin_matcher, perform_storage_cleanup, std::move(callback)));
} }
WebContents* GetWebContents(uint32_t process_id, uint32_t routing_id) { WebContents* GetWebContentsForStoragePartition(uint32_t process_id,
uint32_t routing_id) {
if (process_id != network::mojom::kBrowserProcessId) { if (process_id != network::mojom::kBrowserProcessId) {
return WebContentsImpl::FromRenderFrameHostID(process_id, routing_id); return WebContentsImpl::FromRenderFrameHostID(process_id, routing_id);
} }
return WebContents::FromFrameTreeNodeId(routing_id); return WebContents::FromFrameTreeNodeId(routing_id);
} }
BrowserContext* GetBrowserContext( BrowserContext* GetBrowserContextFromStoragePartition(
base::WeakPtr<StoragePartitionImpl> weak_partition_ptr) { base::WeakPtr<StoragePartitionImpl> weak_partition_ptr) {
return weak_partition_ptr ? weak_partition_ptr->browser_context() : nullptr; return weak_partition_ptr ? weak_partition_ptr->browser_context() : nullptr;
} }
...@@ -1012,10 +1013,10 @@ void StoragePartitionImpl::OnClearSiteData(uint32_t process_id, ...@@ -1012,10 +1013,10 @@ void StoragePartitionImpl::OnClearSiteData(uint32_t process_id,
const std::string& header_value, const std::string& header_value,
int load_flags, int load_flags,
OnClearSiteDataCallback callback) { OnClearSiteDataCallback callback) {
auto browser_context_getter = auto browser_context_getter = base::BindRepeating(
base::BindRepeating(GetBrowserContext, weak_factory_.GetWeakPtr()); GetBrowserContextFromStoragePartition, weak_factory_.GetWeakPtr());
auto web_contents_getter = auto web_contents_getter = base::BindRepeating(
base::BindRepeating(GetWebContents, process_id, routing_id); GetWebContentsForStoragePartition, process_id, routing_id);
ClearSiteDataHandler::HandleHeader(browser_context_getter, ClearSiteDataHandler::HandleHeader(browser_context_getter,
web_contents_getter, url, header_value, web_contents_getter, url, header_value,
load_flags, std::move(callback)); load_flags, std::move(callback));
......
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