| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_picasa_album_table_reader.
h" | 5 #include "chrome/browser/media_galleries/fileapi/safe_picasa_album_table_reader.
h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 void SafePicasaAlbumTableReader::OnProcessStarted() { | 80 void SafePicasaAlbumTableReader::OnProcessStarted() { |
| 81 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 81 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 82 if (parser_state_ != PINGED_UTILITY_PROCESS_STATE) | 82 if (parser_state_ != PINGED_UTILITY_PROCESS_STATE) |
| 83 return; | 83 return; |
| 84 | 84 |
| 85 if (utility_process_host_->GetData().handle == base::kNullProcessHandle) { | 85 if (utility_process_host_->GetData().handle == base::kNullProcessHandle) { |
| 86 DLOG(ERROR) << "Child process handle is null"; | 86 DLOG(ERROR) << "Child process handle is null"; |
| 87 } | 87 } |
| 88 AlbumTableFilesForTransit files_for_transit; | 88 AlbumTableFilesForTransit files_for_transit; |
| 89 files_for_transit.indicator_file = IPC::TakeFileHandleForProcess( | 89 files_for_transit.indicator_file = IPC::TakePlatformFileForTransit( |
| 90 std::move(album_table_files_.indicator_file), | 90 std::move(album_table_files_.indicator_file)); |
| 91 utility_process_host_->GetData().handle); | 91 files_for_transit.category_file = IPC::TakePlatformFileForTransit( |
| 92 files_for_transit.category_file = | 92 std::move(album_table_files_.category_file)); |
| 93 IPC::TakeFileHandleForProcess(std::move(album_table_files_.category_file), | |
| 94 utility_process_host_->GetData().handle); | |
| 95 files_for_transit.date_file = | 93 files_for_transit.date_file = |
| 96 IPC::TakeFileHandleForProcess(std::move(album_table_files_.date_file), | 94 IPC::TakePlatformFileForTransit(std::move(album_table_files_.date_file)); |
| 97 utility_process_host_->GetData().handle); | 95 files_for_transit.filename_file = IPC::TakePlatformFileForTransit( |
| 98 files_for_transit.filename_file = | 96 std::move(album_table_files_.filename_file)); |
| 99 IPC::TakeFileHandleForProcess(std::move(album_table_files_.filename_file), | |
| 100 utility_process_host_->GetData().handle); | |
| 101 files_for_transit.name_file = | 97 files_for_transit.name_file = |
| 102 IPC::TakeFileHandleForProcess(std::move(album_table_files_.name_file), | 98 IPC::TakePlatformFileForTransit(std::move(album_table_files_.name_file)); |
| 103 utility_process_host_->GetData().handle); | |
| 104 files_for_transit.token_file = | 99 files_for_transit.token_file = |
| 105 IPC::TakeFileHandleForProcess(std::move(album_table_files_.token_file), | 100 IPC::TakePlatformFileForTransit(std::move(album_table_files_.token_file)); |
| 106 utility_process_host_->GetData().handle); | |
| 107 files_for_transit.uid_file = | 101 files_for_transit.uid_file = |
| 108 IPC::TakeFileHandleForProcess(std::move(album_table_files_.uid_file), | 102 IPC::TakePlatformFileForTransit(std::move(album_table_files_.uid_file)); |
| 109 utility_process_host_->GetData().handle); | |
| 110 utility_process_host_->Send(new ChromeUtilityMsg_ParsePicasaPMPDatabase( | 103 utility_process_host_->Send(new ChromeUtilityMsg_ParsePicasaPMPDatabase( |
| 111 files_for_transit)); | 104 files_for_transit)); |
| 112 parser_state_ = STARTED_PARSING_STATE; | 105 parser_state_ = STARTED_PARSING_STATE; |
| 113 } | 106 } |
| 114 | 107 |
| 115 void SafePicasaAlbumTableReader::OnParsePicasaPMPDatabaseFinished( | 108 void SafePicasaAlbumTableReader::OnParsePicasaPMPDatabaseFinished( |
| 116 bool parse_success, | 109 bool parse_success, |
| 117 const std::vector<AlbumInfo>& albums, | 110 const std::vector<AlbumInfo>& albums, |
| 118 const std::vector<AlbumInfo>& folders) { | 111 const std::vector<AlbumInfo>& folders) { |
| 119 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 112 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 139 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ProcessStarted, | 132 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ProcessStarted, |
| 140 OnProcessStarted) | 133 OnProcessStarted) |
| 141 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParsePicasaPMPDatabase_Finished, | 134 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParsePicasaPMPDatabase_Finished, |
| 142 OnParsePicasaPMPDatabaseFinished) | 135 OnParsePicasaPMPDatabaseFinished) |
| 143 IPC_MESSAGE_UNHANDLED(handled = false) | 136 IPC_MESSAGE_UNHANDLED(handled = false) |
| 144 IPC_END_MESSAGE_MAP() | 137 IPC_END_MESSAGE_MAP() |
| 145 return handled; | 138 return handled; |
| 146 } | 139 } |
| 147 | 140 |
| 148 } // namespace picasa | 141 } // namespace picasa |
| OLD | NEW |