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

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

Issue 1167163002: chrome: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added some missing message_loop.h includes. Created 5 years, 6 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/media_metadata_parser.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/location.h"
8 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/single_thread_task_runner.h"
9 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
10 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
11 #include "chrome/common/importer/profile_import_process_messages.h" 13 #include "chrome/common/importer/profile_import_process_messages.h"
12 #include "chrome/utility/importer/external_process_importer_bridge.h" 14 #include "chrome/utility/importer/external_process_importer_bridge.h"
13 #include "chrome/utility/importer/importer.h" 15 #include "chrome/utility/importer/importer.h"
14 #include "chrome/utility/importer/importer_creator.h" 16 #include "chrome/utility/importer/importer_creator.h"
15 #include "content/public/utility/utility_thread.h" 17 #include "content/public/utility/utility_thread.h"
16 18
17 namespace { 19 namespace {
18 20
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 59
58 // Create worker thread in which importer runs. 60 // Create worker thread in which importer runs.
59 import_thread_.reset(new base::Thread("import_thread")); 61 import_thread_.reset(new base::Thread("import_thread"));
60 #if defined(OS_WIN) 62 #if defined(OS_WIN)
61 import_thread_->init_com_with_mta(false); 63 import_thread_->init_com_with_mta(false);
62 #endif 64 #endif
63 if (!import_thread_->Start()) { 65 if (!import_thread_->Start()) {
64 NOTREACHED(); 66 NOTREACHED();
65 ImporterCleanup(); 67 ImporterCleanup();
66 } 68 }
67 import_thread_->message_loop()->PostTask( 69 import_thread_->task_runner()->PostTask(
68 FROM_HERE, base::Bind(&Importer::StartImport, importer_.get(), 70 FROM_HERE, base::Bind(&Importer::StartImport, importer_.get(),
69 source_profile, items, bridge_)); 71 source_profile, items, bridge_));
70 } 72 }
71 73
72 void ProfileImportHandler::OnImportCancel() { 74 void ProfileImportHandler::OnImportCancel() {
73 ImporterCleanup(); 75 ImporterCleanup();
74 } 76 }
75 77
76 void ProfileImportHandler::OnImportItemFinished(uint16 item) { 78 void ProfileImportHandler::OnImportItemFinished(uint16 item) {
77 items_to_import_ ^= item; // Remove finished item from mask. 79 items_to_import_ ^= item; // Remove finished item from mask.
78 // If we've finished with all items, notify the browser process. 80 // If we've finished with all items, notify the browser process.
79 if (items_to_import_ == 0) { 81 if (items_to_import_ == 0) {
80 Send(new ProfileImportProcessHostMsg_Import_Finished(true, std::string())); 82 Send(new ProfileImportProcessHostMsg_Import_Finished(true, std::string()));
81 ImporterCleanup(); 83 ImporterCleanup();
82 } 84 }
83 } 85 }
84 86
85 void ProfileImportHandler::ImporterCleanup() { 87 void ProfileImportHandler::ImporterCleanup() {
86 importer_->Cancel(); 88 importer_->Cancel();
87 importer_ = NULL; 89 importer_ = NULL;
88 bridge_ = NULL; 90 bridge_ = NULL;
89 import_thread_.reset(); 91 import_thread_.reset();
90 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); 92 content::UtilityThread::Get()->ReleaseProcessIfNeeded();
91 } 93 }
OLDNEW
« no previous file with comments | « chrome/utility/media_galleries/media_metadata_parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698