Commit 1dbe9949 authored by jialiul's avatar jialiul Committed by Commit bot

Improve memory usage of safe browsing navigation oberver manager.

(And add a TODO for PPAPI download attribution)

BUG=676691

Review-Url: https://codereview.chromium.org/2606843002
Cr-Commit-Position: refs/heads/master@{#440860}
parent 99d86ffd
...@@ -1358,10 +1358,9 @@ class DownloadProtectionService::PPAPIDownloadRequest ...@@ -1358,10 +1358,9 @@ class DownloadProtectionService::PPAPIDownloadRequest
*(request.add_alternate_extensions()) = *(request.add_alternate_extensions()) =
base::FilePath(default_file_path_.FinalExtension()).AsUTF8Unsafe(); base::FilePath(default_file_path_.FinalExtension()).AsUTF8Unsafe();
} }
service_->AddReferrerChainToClientDownloadRequest(
requestor_url_, // TODO(676691): We should add reliable download referrer chain for PPAPI
nullptr, // downloads too.
&request);
if (!request.SerializeToString(&client_download_request_data_)) { if (!request.SerializeToString(&client_download_request_data_)) {
// More of an internal error than anything else. Note that the UNKNOWN // More of an internal error than anything else. Note that the UNKNOWN
...@@ -1821,7 +1820,7 @@ void DownloadProtectionService::AddReferrerChainToClientDownloadRequest( ...@@ -1821,7 +1820,7 @@ void DownloadProtectionService::AddReferrerChainToClientDownloadRequest(
"SafeBrowsing.ReferrerAttributionResult.DownloadAttribution", result, "SafeBrowsing.ReferrerAttributionResult.DownloadAttribution", result,
SafeBrowsingNavigationObserverManager::ATTRIBUTION_FAILURE_TYPE_MAX); SafeBrowsingNavigationObserverManager::ATTRIBUTION_FAILURE_TYPE_MAX);
for (auto entry : attribution_chain) for (auto entry : attribution_chain)
*out_request->add_referrer_chain() = std::move(entry); out_request->add_referrer_chain()->Swap(&entry);
} }
} // namespace safe_browsing } // namespace safe_browsing
...@@ -394,7 +394,7 @@ void SafeBrowsingNavigationObserverManager::AddToReferrerChain( ...@@ -394,7 +394,7 @@ void SafeBrowsingNavigationObserverManager::AddToReferrerChain(
nav_event->target_tab_id); nav_event->target_tab_id);
referrer_chain_entry.set_navigation_time_msec( referrer_chain_entry.set_navigation_time_msec(
nav_event->last_updated.ToJavaTime()); nav_event->last_updated.ToJavaTime());
referrer_chain->push_back(referrer_chain_entry); referrer_chain->push_back(std::move(referrer_chain_entry));
} }
} // namespace safe_browsing } // namespace safe_browsing
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