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

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 Created 5 years, 8 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
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"
10 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
11 #include "chrome/common/importer/profile_import_process_messages.h" 10 #include "chrome/common/importer/profile_import_process_messages.h"
12 #include "chrome/utility/importer/external_process_importer_bridge.h" 11 #include "chrome/utility/importer/external_process_importer_bridge.h"
13 #include "chrome/utility/importer/importer.h" 12 #include "chrome/utility/importer/importer.h"
14 #include "chrome/utility/importer/importer_creator.h" 13 #include "chrome/utility/importer/importer_creator.h"
15 #include "content/public/utility/utility_thread.h" 14 #include "content/public/utility/utility_thread.h"
16 15
17 namespace { 16 namespace {
18 17
19 bool Send(IPC::Message* message) { 18 bool Send(IPC::Message* message) {
(...skipping 18 matching lines...) Expand all
38 return handled; 37 return handled;
39 } 38 }
40 39
41 void ProfileImportHandler::OnImportStart( 40 void ProfileImportHandler::OnImportStart(
42 const importer::SourceProfile& source_profile, 41 const importer::SourceProfile& source_profile,
43 uint16 items, 42 uint16 items,
44 const base::DictionaryValue& localized_strings) { 43 const base::DictionaryValue& localized_strings) {
45 bridge_ = new ExternalProcessImporterBridge( 44 bridge_ = new ExternalProcessImporterBridge(
46 localized_strings, 45 localized_strings,
47 content::UtilityThread::Get(), 46 content::UtilityThread::Get(),
48 base::MessageLoopProxy::current().get()); 47 base::ThreadTaskRunnerHandle::Get().get());
49 importer_ = importer::CreateImporterByType(source_profile.importer_type); 48 importer_ = importer::CreateImporterByType(source_profile.importer_type);
50 if (!importer_.get()) { 49 if (!importer_.get()) {
51 Send(new ProfileImportProcessHostMsg_Import_Finished( 50 Send(new ProfileImportProcessHostMsg_Import_Finished(
52 false, "Importer could not be created.")); 51 false, "Importer could not be created."));
53 return; 52 return;
54 } 53 }
55 54
56 items_to_import_ = items; 55 items_to_import_ = items;
57 56
58 // Create worker thread in which importer runs. 57 // Create worker thread in which importer runs.
(...skipping 23 matching lines...) Expand all
82 } 81 }
83 } 82 }
84 83
85 void ProfileImportHandler::ImporterCleanup() { 84 void ProfileImportHandler::ImporterCleanup() {
86 importer_->Cancel(); 85 importer_->Cancel();
87 importer_ = NULL; 86 importer_ = NULL;
88 bridge_ = NULL; 87 bridge_ = NULL;
89 import_thread_.reset(); 88 import_thread_.reset();
90 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); 89 content::UtilityThread::Get()->ReleaseProcessIfNeeded();
91 } 90 }
OLDNEW
« chrome/utility/profile_import_handler.h ('K') | « chrome/utility/profile_import_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698