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

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

Issue 2283373002: Remove unneeded scoped_refptr<>::get() on method binding (Closed)
Patch Set: Created 4 years, 3 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/location.h" 8 #include "base/location.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // Create worker thread in which importer runs. 62 // Create worker thread in which importer runs.
63 import_thread_.reset(new base::Thread("import_thread")); 63 import_thread_.reset(new base::Thread("import_thread"));
64 #if defined(OS_WIN) 64 #if defined(OS_WIN)
65 import_thread_->init_com_with_mta(false); 65 import_thread_->init_com_with_mta(false);
66 #endif 66 #endif
67 if (!import_thread_->Start()) { 67 if (!import_thread_->Start()) {
68 NOTREACHED(); 68 NOTREACHED();
69 ImporterCleanup(); 69 ImporterCleanup();
70 } 70 }
71 import_thread_->task_runner()->PostTask( 71 import_thread_->task_runner()->PostTask(
72 FROM_HERE, base::Bind(&Importer::StartImport, importer_.get(), 72 FROM_HERE, base::Bind(&Importer::StartImport, importer_,
73 source_profile, items, base::RetainedRef(bridge_))); 73 source_profile, items, base::RetainedRef(bridge_)));
74 } 74 }
75 75
76 void ProfileImportHandler::OnImportCancel() { 76 void ProfileImportHandler::OnImportCancel() {
77 ImporterCleanup(); 77 ImporterCleanup();
78 } 78 }
79 79
80 void ProfileImportHandler::OnImportItemFinished(uint16_t item) { 80 void ProfileImportHandler::OnImportItemFinished(uint16_t item) {
81 items_to_import_ ^= item; // Remove finished item from mask. 81 items_to_import_ ^= item; // Remove finished item from mask.
82 // If we've finished with all items, notify the browser process. 82 // If we've finished with all items, notify the browser process.
83 if (items_to_import_ == 0) { 83 if (items_to_import_ == 0) {
84 Send(new ProfileImportProcessHostMsg_Import_Finished(true, std::string())); 84 Send(new ProfileImportProcessHostMsg_Import_Finished(true, std::string()));
85 ImporterCleanup(); 85 ImporterCleanup();
86 } 86 }
87 } 87 }
88 88
89 void ProfileImportHandler::ImporterCleanup() { 89 void ProfileImportHandler::ImporterCleanup() {
90 importer_->Cancel(); 90 importer_->Cancel();
91 importer_ = NULL; 91 importer_ = NULL;
92 bridge_ = NULL; 92 bridge_ = NULL;
93 import_thread_.reset(); 93 import_thread_.reset();
94 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); 94 content::UtilityThread::Get()->ReleaseProcessIfNeeded();
95 } 95 }
OLDNEW
« no previous file with comments | « chrome/service/cloud_print/printer_job_handler.cc ('k') | components/history/core/browser/history_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698