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

Unified Diff: chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.cc

Issue 2751573004: Image writer client: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.cc
diff --git a/chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.cc b/chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.cc
index 30ab7cd16c59ec0d5a0804907dd53bcf7249c5eb..1fff11c1f51da0fba328818e21f0b91017a1efc3 100644
--- a/chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.cc
+++ b/chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.cc
@@ -72,7 +72,7 @@ void ImageWriterUtilityClient::Write(const ProgressCallback& progress_callback,
success_callback_ = success_callback;
error_callback_ = error_callback;
- StartUtilityProcess();
+ StartUtilityProcessIfNeeded();
extensions::mojom::RemovableStorageWriterClientPtr client;
removable_storage_writer_client_ =
@@ -94,7 +94,7 @@ void ImageWriterUtilityClient::Verify(const ProgressCallback& progress_callback,
success_callback_ = success_callback;
error_callback_ = error_callback;
- StartUtilityProcess();
+ StartUtilityProcessIfNeeded();
extensions::mojom::RemovableStorageWriterClientPtr client;
removable_storage_writer_client_ =
@@ -118,18 +118,16 @@ void ImageWriterUtilityClient::Shutdown() {
utility_process_mojo_client_.reset();
}
-void ImageWriterUtilityClient::StartUtilityProcess() {
+void ImageWriterUtilityClient::StartUtilityProcessIfNeeded() {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (utility_process_mojo_client_)
return;
- const base::string16 utility_process_name =
- l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_IMAGE_WRITER_NAME);
-
- utility_process_mojo_client_.reset(
- new content::UtilityProcessMojoClient<
- extensions::mojom::RemovableStorageWriter>(utility_process_name));
+ utility_process_mojo_client_ =
+ base::MakeUnique<content::UtilityProcessMojoClient<
+ extensions::mojom::RemovableStorageWriter>>(
+ l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_IMAGE_WRITER_NAME));
utility_process_mojo_client_->set_error_callback(
base::Bind(&ImageWriterUtilityClient::UtilityProcessError, this));
« no previous file with comments | « chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698