Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1232)

Unified Diff: chrome/utility/chrome_content_utility_client.cc

Issue 2599393002: Revert of Convert utility process out-of-process file patching to mojo (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/utility/chrome_content_utility_client.cc
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc
index a0b7b1709b6698ad3fb5e74484db346469605ab2..f95ceadf3fa977e555000d5a31af82ab7574b0df 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -13,7 +13,6 @@
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/common/chrome_utility_messages.h"
-#include "chrome/common/file_patcher.mojom.h"
#include "chrome/common/safe_browsing/zip_analyzer.h"
#include "chrome/common/safe_browsing/zip_analyzer_results.h"
#include "chrome/utility/chrome_content_utility_ipc_whitelist.h"
@@ -64,7 +63,6 @@
namespace {
-#if defined(OS_CHROMEOS) || defined(FULL_SAFE_BROWSING)
bool Send(IPC::Message* message) {
return content::UtilityThread::Get()->Send(message);
}
@@ -72,41 +70,6 @@
void ReleaseProcessIfNeeded() {
content::UtilityThread::Get()->ReleaseProcessIfNeeded();
}
-#endif // defined(OS_CHROMEOS) || defined(FULL_SAFE_BROWSING)
-
-class FilePatcherImpl : public chrome::mojom::FilePatcher {
- public:
- FilePatcherImpl() = default;
- ~FilePatcherImpl() override = default;
-
- static void Create(chrome::mojom::FilePatcherRequest request) {
- mojo::MakeStrongBinding(base::MakeUnique<FilePatcherImpl>(),
- std::move(request));
- }
-
- private:
- // chrome::mojom::FilePatcher:
-
- void PatchFileBsdiff(base::File input_file,
- base::File patch_file,
- base::File output_file,
- const PatchFileBsdiffCallback& callback) override {
- const int patch_result_status = bsdiff::ApplyBinaryPatch(
- std::move(input_file), std::move(patch_file), std::move(output_file));
- callback.Run(patch_result_status);
- }
-
- void PatchFileCourgette(base::File input_file,
- base::File patch_file,
- base::File output_file,
- const PatchFileCourgetteCallback& callback) override {
- const int patch_result_status = courgette::ApplyEnsemblePatch(
- std::move(input_file), std::move(patch_file), std::move(output_file));
- callback.Run(patch_result_status);
- }
-
- DISALLOW_COPY_AND_ASSIGN(FilePatcherImpl);
-};
#if !defined(OS_ANDROID)
void CreateProxyResolverFactory(
@@ -192,6 +155,10 @@
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ChromeContentUtilityClient, message)
+ IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileBsdiff,
+ OnPatchFileBsdiff)
+ IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileCourgette,
+ OnPatchFileCourgette)
#if defined(FULL_SAFE_BROWSING)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection,
OnAnalyzeZipFileForDownloadProtection)
@@ -233,7 +200,6 @@
if (filter_messages_)
return;
- registry->AddInterface(base::Bind(&FilePatcherImpl::Create));
#if !defined(OS_ANDROID)
registry->AddInterface<net::interfaces::ProxyResolverFactory>(
base::Bind(CreateProxyResolverFactory));
@@ -297,6 +263,30 @@
ReleaseProcessIfNeeded();
}
#endif // defined(OS_CHROMEOS)
+
+void ChromeContentUtilityClient::OnPatchFileBsdiff(
+ const IPC::PlatformFileForTransit& input_file,
+ const IPC::PlatformFileForTransit& patch_file,
+ const IPC::PlatformFileForTransit& output_file) {
+ const int patch_status = bsdiff::ApplyBinaryPatch(
+ IPC::PlatformFileForTransitToFile(input_file),
+ IPC::PlatformFileForTransitToFile(patch_file),
+ IPC::PlatformFileForTransitToFile(output_file));
+ Send(new ChromeUtilityHostMsg_PatchFile_Finished(patch_status));
+ ReleaseProcessIfNeeded();
+}
+
+void ChromeContentUtilityClient::OnPatchFileCourgette(
+ const IPC::PlatformFileForTransit& input_file,
+ const IPC::PlatformFileForTransit& patch_file,
+ const IPC::PlatformFileForTransit& output_file) {
+ const int patch_status = courgette::ApplyEnsemblePatch(
+ IPC::PlatformFileForTransitToFile(input_file),
+ IPC::PlatformFileForTransitToFile(patch_file),
+ IPC::PlatformFileForTransitToFile(output_file));
+ Send(new ChromeUtilityHostMsg_PatchFile_Finished(patch_status));
+ ReleaseProcessIfNeeded();
+}
#if defined(FULL_SAFE_BROWSING)
void ChromeContentUtilityClient::OnAnalyzeZipFileForDownloadProtection(
« no previous file with comments | « chrome/test/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698