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

Side by Side Diff: chrome/browser/media_galleries/fileapi/safe_picasa_album_table_reader.cc

Issue 1885813002: Delete the utility process startup ping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 void SafePicasaAlbumTableReader::StartWorkOnIOThread() { 64 void SafePicasaAlbumTableReader::StartWorkOnIOThread() {
65 DCHECK_CURRENTLY_ON(BrowserThread::IO); 65 DCHECK_CURRENTLY_ON(BrowserThread::IO);
66 DCHECK_EQ(INITIAL_STATE, parser_state_); 66 DCHECK_EQ(INITIAL_STATE, parser_state_);
67 67
68 utility_process_host_ = content::UtilityProcessHost::Create( 68 utility_process_host_ = content::UtilityProcessHost::Create(
69 this, 69 this,
70 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get()) 70 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get())
71 ->AsWeakPtr(); 71 ->AsWeakPtr();
72 utility_process_host_->SetName(l10n_util::GetStringUTF16( 72 utility_process_host_->SetName(l10n_util::GetStringUTF16(
73 IDS_UTILITY_PROCESS_MEDIA_LIBRARY_FILE_CHECKER_NAME)); 73 IDS_UTILITY_PROCESS_MEDIA_LIBRARY_FILE_CHECKER_NAME));
74 // Wait for the startup notification before sending the main IPC to the
75 // utility process, so that we can dup the file handle.
76 utility_process_host_->Send(new ChromeUtilityMsg_StartupPing);
77 parser_state_ = PINGED_UTILITY_PROCESS_STATE;
78 }
79 74
80 void SafePicasaAlbumTableReader::OnProcessStarted() {
81 DCHECK_CURRENTLY_ON(BrowserThread::IO);
82 if (parser_state_ != PINGED_UTILITY_PROCESS_STATE)
83 return;
84
85 if (utility_process_host_->GetData().handle == base::kNullProcessHandle) {
86 DLOG(ERROR) << "Child process handle is null";
87 }
88 AlbumTableFilesForTransit files_for_transit; 75 AlbumTableFilesForTransit files_for_transit;
89 files_for_transit.indicator_file = IPC::TakePlatformFileForTransit( 76 files_for_transit.indicator_file = IPC::TakePlatformFileForTransit(
90 std::move(album_table_files_.indicator_file)); 77 std::move(album_table_files_.indicator_file));
91 files_for_transit.category_file = IPC::TakePlatformFileForTransit( 78 files_for_transit.category_file = IPC::TakePlatformFileForTransit(
92 std::move(album_table_files_.category_file)); 79 std::move(album_table_files_.category_file));
93 files_for_transit.date_file = 80 files_for_transit.date_file =
94 IPC::TakePlatformFileForTransit(std::move(album_table_files_.date_file)); 81 IPC::TakePlatformFileForTransit(std::move(album_table_files_.date_file));
95 files_for_transit.filename_file = IPC::TakePlatformFileForTransit( 82 files_for_transit.filename_file = IPC::TakePlatformFileForTransit(
96 std::move(album_table_files_.filename_file)); 83 std::move(album_table_files_.filename_file));
97 files_for_transit.name_file = 84 files_for_transit.name_file =
(...skipping 24 matching lines...) Expand all
122 void SafePicasaAlbumTableReader::OnProcessCrashed(int exit_code) { 109 void SafePicasaAlbumTableReader::OnProcessCrashed(int exit_code) {
123 DLOG(ERROR) << "SafePicasaAlbumTableReader::OnProcessCrashed()"; 110 DLOG(ERROR) << "SafePicasaAlbumTableReader::OnProcessCrashed()";
124 OnParsePicasaPMPDatabaseFinished( 111 OnParsePicasaPMPDatabaseFinished(
125 false, std::vector<AlbumInfo>(), std::vector<AlbumInfo>()); 112 false, std::vector<AlbumInfo>(), std::vector<AlbumInfo>());
126 } 113 }
127 114
128 bool SafePicasaAlbumTableReader::OnMessageReceived( 115 bool SafePicasaAlbumTableReader::OnMessageReceived(
129 const IPC::Message& message) { 116 const IPC::Message& message) {
130 bool handled = true; 117 bool handled = true;
131 IPC_BEGIN_MESSAGE_MAP(SafePicasaAlbumTableReader, message) 118 IPC_BEGIN_MESSAGE_MAP(SafePicasaAlbumTableReader, message)
132 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ProcessStarted,
133 OnProcessStarted)
134 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParsePicasaPMPDatabase_Finished, 119 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParsePicasaPMPDatabase_Finished,
135 OnParsePicasaPMPDatabaseFinished) 120 OnParsePicasaPMPDatabaseFinished)
136 IPC_MESSAGE_UNHANDLED(handled = false) 121 IPC_MESSAGE_UNHANDLED(handled = false)
137 IPC_END_MESSAGE_MAP() 122 IPC_END_MESSAGE_MAP()
138 return handled; 123 return handled;
139 } 124 }
140 125
141 } // namespace picasa 126 } // namespace picasa
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698