From f08cb0022527081c078e8b96062e6c9b4fbda151 Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Fri, 26 Jul 2019 16:48:06 +0000 Subject: [PATCH] BinaryUploadService: change parameter passing that cannot afford abstract class The method UploadForDeepScanning gets a Request as parameter. But Request is an abstract class, so GCC will not allow that declaration (polimorphycs should be passed by reference). Use std::unique_ptr so BinaryUploadService can assume ownership. Bug: 819294 Change-Id: I9e8c75cc92b01abd704d9049b0421555377da5ba Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1713550 Reviewed-by: Daniel Rubery Commit-Queue: José Dapena Paz Cr-Commit-Position: refs/heads/master@{#681333} --- diff --git a/chrome/browser/safe_browsing/download_protection/binary_upload_service.cc b/chrome/browser/safe_browsing/download_protection/binary_upload_service.cc index 6430c89..4e90487 100644 --- a/chrome/browser/safe_browsing/download_protection/binary_upload_service.cc +++ b/chrome/browser/safe_browsing/download_protection/binary_upload_service.cc @@ -10,7 +10,7 @@ namespace safe_browsing { void BinaryUploadService::UploadForDeepScanning( - BinaryUploadService::Request request) { + std::unique_ptr request) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); NOTREACHED(); } diff --git a/chrome/browser/safe_browsing/download_protection/binary_upload_service.h b/chrome/browser/safe_browsing/download_protection/binary_upload_service.h index d2dfd83..9b6f395 100644 --- a/chrome/browser/safe_browsing/download_protection/binary_upload_service.h +++ b/chrome/browser/safe_browsing/download_protection/binary_upload_service.h @@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_BINARY_UPLOAD_SERVICE_H_ #define CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_BINARY_UPLOAD_SERVICE_H_ +#include + #include "base/callback.h" #include "components/safe_browsing/proto/webprotect.pb.h" @@ -40,6 +42,7 @@ public: // |callback| will run on the UI thread. explicit Request(Callback callback); + virtual ~Request() = default; Request(const Request&) = delete; Request& operator=(const Request&) = delete; @@ -67,7 +70,7 @@ // Upload the given file contents for deep scanning. The results will be // returned asynchronously by calling |request|'s |callback|. This must be // called on the UI thread. - void UploadForDeepScanning(Request request); + void UploadForDeepScanning(std::unique_ptr request); }; } // namespace safe_browsing