Chromium Code Reviews| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 9 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
| 10 #include "chrome/common/chrome_utility_messages.h" | 10 #include "chrome/common/chrome_utility_messages.h" |
| 11 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" | 11 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" |
| 12 #include "chrome/grit/generated_resources.h" | |
| 12 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/child_process_data.h" | 14 #include "content/public/browser/child_process_data.h" |
| 15 #include "ui/base/l10n/l10n_util.h" | |
| 14 | 16 |
| 15 using content::BrowserThread; | 17 using content::BrowserThread; |
| 16 | 18 |
| 17 namespace picasa { | 19 namespace picasa { |
| 18 | 20 |
| 19 SafePicasaAlbumTableReader::SafePicasaAlbumTableReader( | 21 SafePicasaAlbumTableReader::SafePicasaAlbumTableReader( |
| 20 AlbumTableFiles album_table_files) | 22 AlbumTableFiles album_table_files) |
| 21 : album_table_files_(album_table_files.Pass()), | 23 : album_table_files_(album_table_files.Pass()), |
| 22 parser_state_(INITIAL_STATE) { | 24 parser_state_(INITIAL_STATE) { |
| 23 // TODO(tommycli): Add DCHECK to make sure |album_table_files| are all | 25 // TODO(tommycli): Add DCHECK to make sure |album_table_files| are all |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 } | 60 } |
| 59 | 61 |
| 60 void SafePicasaAlbumTableReader::StartWorkOnIOThread() { | 62 void SafePicasaAlbumTableReader::StartWorkOnIOThread() { |
| 61 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 63 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 62 DCHECK_EQ(INITIAL_STATE, parser_state_); | 64 DCHECK_EQ(INITIAL_STATE, parser_state_); |
| 63 | 65 |
| 64 utility_process_host_ = content::UtilityProcessHost::Create( | 66 utility_process_host_ = content::UtilityProcessHost::Create( |
| 65 this, | 67 this, |
| 66 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get()) | 68 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get()) |
| 67 ->AsWeakPtr(); | 69 ->AsWeakPtr(); |
| 70 utility_process_host_->SetName(l10n_util::GetStringUTF16( | |
| 71 IDS_UTILITY_PROCESS_MEDIA_LIBRARY_FILE_CHECKER_NAME)); | |
|
Charlie Reis
2015/04/06 23:47:40
I'm guessing it's intentional to give the utility
| |
| 68 // Wait for the startup notification before sending the main IPC to the | 72 // Wait for the startup notification before sending the main IPC to the |
| 69 // utility process, so that we can dup the file handle. | 73 // utility process, so that we can dup the file handle. |
| 70 utility_process_host_->Send(new ChromeUtilityMsg_StartupPing); | 74 utility_process_host_->Send(new ChromeUtilityMsg_StartupPing); |
| 71 parser_state_ = PINGED_UTILITY_PROCESS_STATE; | 75 parser_state_ = PINGED_UTILITY_PROCESS_STATE; |
| 72 } | 76 } |
| 73 | 77 |
| 74 void SafePicasaAlbumTableReader::OnProcessStarted() { | 78 void SafePicasaAlbumTableReader::OnProcessStarted() { |
| 75 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 79 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 76 if (parser_state_ != PINGED_UTILITY_PROCESS_STATE) | 80 if (parser_state_ != PINGED_UTILITY_PROCESS_STATE) |
| 77 return; | 81 return; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ProcessStarted, | 137 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ProcessStarted, |
| 134 OnProcessStarted) | 138 OnProcessStarted) |
| 135 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParsePicasaPMPDatabase_Finished, | 139 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParsePicasaPMPDatabase_Finished, |
| 136 OnParsePicasaPMPDatabaseFinished) | 140 OnParsePicasaPMPDatabaseFinished) |
| 137 IPC_MESSAGE_UNHANDLED(handled = false) | 141 IPC_MESSAGE_UNHANDLED(handled = false) |
| 138 IPC_END_MESSAGE_MAP() | 142 IPC_END_MESSAGE_MAP() |
| 139 return handled; | 143 return handled; |
| 140 } | 144 } |
| 141 | 145 |
| 142 } // namespace picasa | 146 } // namespace picasa |
| OLD | NEW |