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

Side by Side Diff: chrome/browser/component_updater/component_patcher_operation_out_of_process.cc

Issue 2750763003: Out-of-process file patcher: create mojo client with MakeUnique<> (Closed)
Patch Set: Created 3 years, 9 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr ocess.h" 5 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr ocess.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 base::Passed(&output_file))); 54 base::Passed(&output_file)));
55 } 55 }
56 56
57 void ChromeOutOfProcessPatcher::PatchOnIOThread(const std::string& operation, 57 void ChromeOutOfProcessPatcher::PatchOnIOThread(const std::string& operation,
58 base::File input_file, 58 base::File input_file,
59 base::File patch_file, 59 base::File patch_file,
60 base::File output_file) { 60 base::File output_file) {
61 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 61 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
62 DCHECK(!utility_process_mojo_client_); 62 DCHECK(!utility_process_mojo_client_);
63 63
64 const base::string16 utility_process_name = 64 utility_process_mojo_client_ = base::MakeUnique<
65 l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_COMPONENT_PATCHER_NAME); 65 content::UtilityProcessMojoClient<chrome::mojom::FilePatcher>>(
66 66 l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_COMPONENT_PATCHER_NAME));
67 utility_process_mojo_client_.reset(
68 new content::UtilityProcessMojoClient<chrome::mojom::FilePatcher>(
69 utility_process_name));
70 utility_process_mojo_client_->set_error_callback( 67 utility_process_mojo_client_->set_error_callback(
71 base::Bind(&ChromeOutOfProcessPatcher::PatchDone, this, -1)); 68 base::Bind(&ChromeOutOfProcessPatcher::PatchDone, this, -1));
72 69
73 utility_process_mojo_client_->Start(); // Start the utility process. 70 utility_process_mojo_client_->Start(); // Start the utility process.
74 71
75 if (operation == update_client::kBsdiff) { 72 if (operation == update_client::kBsdiff) {
76 utility_process_mojo_client_->service()->PatchFileBsdiff( 73 utility_process_mojo_client_->service()->PatchFileBsdiff(
77 std::move(input_file), std::move(patch_file), std::move(output_file), 74 std::move(input_file), std::move(patch_file), std::move(output_file),
78 base::Bind(&ChromeOutOfProcessPatcher::PatchDone, this)); 75 base::Bind(&ChromeOutOfProcessPatcher::PatchDone, this));
79 } else if (operation == update_client::kCourgette) { 76 } else if (operation == update_client::kCourgette) {
80 utility_process_mojo_client_->service()->PatchFileCourgette( 77 utility_process_mojo_client_->service()->PatchFileCourgette(
81 std::move(input_file), std::move(patch_file), std::move(output_file), 78 std::move(input_file), std::move(patch_file), std::move(output_file),
82 base::Bind(&ChromeOutOfProcessPatcher::PatchDone, this)); 79 base::Bind(&ChromeOutOfProcessPatcher::PatchDone, this));
83 } else { 80 } else {
84 NOTREACHED(); 81 NOTREACHED();
85 } 82 }
86 } 83 }
87 84
88 void ChromeOutOfProcessPatcher::PatchDone(int result) { 85 void ChromeOutOfProcessPatcher::PatchDone(int result) {
89 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 86 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
90 87
91 utility_process_mojo_client_.reset(); // Terminate the utility process. 88 utility_process_mojo_client_.reset(); // Terminate the utility process.
92 task_runner_->PostTask(FROM_HERE, base::Bind(callback_, result)); 89 task_runner_->PostTask(FROM_HERE, base::Bind(callback_, result));
93 } 90 }
94 91
95 } // namespace component_updater 92 } // namespace component_updater
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698