| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/media_galleries/fileapi/safe_media_metadata_parser.h" | 5 #include "chrome/browser/media_galleries/fileapi/safe_media_metadata_parser.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 const std::vector<AttachedImage>& attached_images) { | 73 const std::vector<AttachedImage>& attached_images) { |
| 74 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 74 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 75 DCHECK(!callback_.is_null()); | 75 DCHECK(!callback_.is_null()); |
| 76 | 76 |
| 77 if (parser_state_ != STARTED_PARSING_STATE) | 77 if (parser_state_ != STARTED_PARSING_STATE) |
| 78 return; | 78 return; |
| 79 | 79 |
| 80 // We need to make a scoped copy of this vector since it will be destroyed | 80 // We need to make a scoped copy of this vector since it will be destroyed |
| 81 // at the end of the IPC message handler. | 81 // at the end of the IPC message handler. |
| 82 std::unique_ptr<std::vector<metadata::AttachedImage>> attached_images_copy = | 82 std::unique_ptr<std::vector<metadata::AttachedImage>> attached_images_copy = |
| 83 base::WrapUnique( | 83 base::MakeUnique<std::vector<metadata::AttachedImage>>(attached_images); |
| 84 new std::vector<metadata::AttachedImage>(attached_images)); | |
| 85 | 84 |
| 86 BrowserThread::PostTask( | 85 BrowserThread::PostTask( |
| 87 BrowserThread::UI, FROM_HERE, | 86 BrowserThread::UI, FROM_HERE, |
| 88 base::Bind(callback_, parse_success, | 87 base::Bind(callback_, parse_success, |
| 89 base::Passed(base::WrapUnique(metadata_dictionary.DeepCopy())), | 88 base::Passed(base::WrapUnique(metadata_dictionary.DeepCopy())), |
| 90 base::Passed(&attached_images_copy))); | 89 base::Passed(&attached_images_copy))); |
| 91 parser_state_ = FINISHED_PARSING_STATE; | 90 parser_state_ = FINISHED_PARSING_STATE; |
| 92 } | 91 } |
| 93 | 92 |
| 94 void SafeMediaMetadataParser::OnUtilityProcessRequestBlobBytes( | 93 void SafeMediaMetadataParser::OnUtilityProcessRequestBlobBytes( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 OnParseMediaMetadataFinished) | 155 OnParseMediaMetadataFinished) |
| 157 IPC_MESSAGE_HANDLER( | 156 IPC_MESSAGE_HANDLER( |
| 158 ChromeUtilityHostMsg_RequestBlobBytes, | 157 ChromeUtilityHostMsg_RequestBlobBytes, |
| 159 OnUtilityProcessRequestBlobBytes) | 158 OnUtilityProcessRequestBlobBytes) |
| 160 IPC_MESSAGE_UNHANDLED(handled = false) | 159 IPC_MESSAGE_UNHANDLED(handled = false) |
| 161 IPC_END_MESSAGE_MAP() | 160 IPC_END_MESSAGE_MAP() |
| 162 return handled; | 161 return handled; |
| 163 } | 162 } |
| 164 | 163 |
| 165 } // namespace metadata | 164 } // namespace metadata |
| OLD | NEW |