| OLD | NEW |
| 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/browser/chromeos/file_manager/zip_file_creator.h" | 5 #include "chrome/browser/chromeos/file_manager/zip_file_creator.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 utility_process_mojo_client_->Start(); | 68 utility_process_mojo_client_->Start(); |
| 69 | 69 |
| 70 utility_process_mojo_client_->service()->CreateZipFile( | 70 utility_process_mojo_client_->service()->CreateZipFile( |
| 71 src_dir_, src_relative_paths_, std::move(file), | 71 src_dir_, src_relative_paths_, std::move(file), |
| 72 base::Bind(&ZipFileCreator::ReportDone, this)); | 72 base::Bind(&ZipFileCreator::ReportDone, this)); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void ZipFileCreator::ReportDone(bool success) { | 75 void ZipFileCreator::ReportDone(bool success) { |
| 76 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 76 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 77 | 77 |
| 78 // The current user of this class holds no reference to |this| so resetting | |
| 79 // the |utility_process_mojo_client_| here could release the last reference | |
| 80 // and delete |this|. So save |callback_| before resetting the client. | |
| 81 auto callback = base::ResetAndReturn(&callback_); | |
| 82 utility_process_mojo_client_.reset(); | 78 utility_process_mojo_client_.reset(); |
| 83 callback.Run(success); | 79 base::ResetAndReturn(&callback_).Run(success); |
| 84 } | 80 } |
| 85 | 81 |
| 86 } // namespace file_manager | 82 } // namespace file_manager |
| OLD | NEW |