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

Side by Side Diff: chrome/utility/profile_import_handler.cc

Issue 1111673003: [chrome/utility] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Review Comments for the pattern Created 5 years, 7 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 | « chrome/utility/media_galleries/ipc_data_source.cc ('k') | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/utility/profile_import_handler.h" 5 #include "chrome/utility/profile_import_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "chrome/common/importer/profile_import_process_messages.h" 11 #include "chrome/common/importer/profile_import_process_messages.h"
12 #include "chrome/utility/importer/external_process_importer_bridge.h" 12 #include "chrome/utility/importer/external_process_importer_bridge.h"
13 #include "chrome/utility/importer/importer.h" 13 #include "chrome/utility/importer/importer.h"
14 #include "chrome/utility/importer/importer_creator.h" 14 #include "chrome/utility/importer/importer_creator.h"
15 #include "content/public/utility/utility_thread.h" 15 #include "content/public/utility/utility_thread.h"
16 16
17 namespace { 17 namespace {
18 18
19 bool Send(IPC::Message* message) { 19 bool Send(IPC::Message* message) {
(...skipping 18 matching lines...) Expand all
38 return handled; 38 return handled;
39 } 39 }
40 40
41 void ProfileImportHandler::OnImportStart( 41 void ProfileImportHandler::OnImportStart(
42 const importer::SourceProfile& source_profile, 42 const importer::SourceProfile& source_profile,
43 uint16 items, 43 uint16 items,
44 const base::DictionaryValue& localized_strings) { 44 const base::DictionaryValue& localized_strings) {
45 bridge_ = new ExternalProcessImporterBridge( 45 bridge_ = new ExternalProcessImporterBridge(
46 localized_strings, 46 localized_strings,
47 content::UtilityThread::Get(), 47 content::UtilityThread::Get(),
48 base::MessageLoopProxy::current().get()); 48 base::ThreadTaskRunnerHandle::Get().get());
49 importer_ = importer::CreateImporterByType(source_profile.importer_type); 49 importer_ = importer::CreateImporterByType(source_profile.importer_type);
50 if (!importer_.get()) { 50 if (!importer_.get()) {
51 Send(new ProfileImportProcessHostMsg_Import_Finished( 51 Send(new ProfileImportProcessHostMsg_Import_Finished(
52 false, "Importer could not be created.")); 52 false, "Importer could not be created."));
53 return; 53 return;
54 } 54 }
55 55
56 items_to_import_ = items; 56 items_to_import_ = items;
57 57
58 // Create worker thread in which importer runs. 58 // Create worker thread in which importer runs.
(...skipping 23 matching lines...) Expand all
82 } 82 }
83 } 83 }
84 84
85 void ProfileImportHandler::ImporterCleanup() { 85 void ProfileImportHandler::ImporterCleanup() {
86 importer_->Cancel(); 86 importer_->Cancel();
87 importer_ = NULL; 87 importer_ = NULL;
88 bridge_ = NULL; 88 bridge_ = NULL;
89 import_thread_.reset(); 89 import_thread_.reset();
90 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); 90 content::UtilityThread::Get()->ReleaseProcessIfNeeded();
91 } 91 }
OLDNEW
« no previous file with comments | « chrome/utility/media_galleries/ipc_data_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698