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

Side by Side Diff: components/translate/content/browser/data_file_browser_cld_data_provider.cc

Issue 1858973002: ipc: Rename GetFileHandleForProcess->GetPlatformFileForTransit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp16_ipc_pfft_implementation
Patch Set: Comments from tsepez. 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 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 // NOT DEAD CODE! 5 // NOT DEAD CODE!
6 // This code isn't dead, even if it isn't currently being used. Please refer to: 6 // This code isn't dead, even if it isn't currently being used. Please refer to:
7 // https://www.chromium.org/developers/how-tos/compact-language-detector-cld-dat a-source-configuration 7 // https://www.chromium.org/developers/how-tos/compact-language-detector-cld-dat a-source-configuration
8 8
9 #include "components/translate/content/browser/data_file_browser_cld_data_provid er.h" 9 #include "components/translate/content/browser/data_file_browser_cld_data_provid er.h"
10 10
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 153
154 content::RenderProcessHost* render_process_host = 154 content::RenderProcessHost* render_process_host =
155 render_frame_host->GetProcess(); 155 render_frame_host->GetProcess();
156 if (render_process_host == NULL) { 156 if (render_process_host == NULL) {
157 // Render process destroyed, render frame not yet dead. No need to bother. 157 // Render process destroyed, render frame not yet dead. No need to bother.
158 VLOG(1) << "Lost render process, giving up"; 158 VLOG(1) << "Lost render process, giving up";
159 return; 159 return;
160 } 160 }
161 161
162 // Data available, respond to the request. 162 // Data available, respond to the request.
163 base::ProcessHandle render_process_handle = render_process_host->GetHandle();
164 IPC::PlatformFileForTransit ipc_platform_file = 163 IPC::PlatformFileForTransit ipc_platform_file =
165 IPC::GetFileHandleForProcess(handle->GetPlatformFile(), 164 IPC::GetPlatformFileForTransit(handle->GetPlatformFile(), false);
166 render_process_handle, false);
167 165
168 // In general, sending a response from within the code path that is processing 166 // In general, sending a response from within the code path that is processing
169 // a request is discouraged because there is potential for deadlock (if the 167 // a request is discouraged because there is potential for deadlock (if the
170 // methods are sent synchronously) or loops (if the response can trigger a 168 // methods are sent synchronously) or loops (if the response can trigger a
171 // new request). Neither of these concerns is relevant in this code, so 169 // new request). Neither of these concerns is relevant in this code, so
172 // sending the response from within the code path of the request handler is 170 // sending the response from within the code path of the request handler is
173 // safe. 171 // safe.
174 render_frame_host->Send( 172 render_frame_host->Send(
175 new ChromeFrameMsg_CldDataFileAvailable(render_frame_host->GetRoutingID(), 173 new ChromeFrameMsg_CldDataFileAvailable(render_frame_host->GetRoutingID(),
176 ipc_platform_file, 174 ipc_platform_file,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 // Else, this request has taken care of it all. Cache all info. 233 // Else, this request has taken care of it all. Cache all info.
236 VLOG(1) << "Caching CLD data file information."; 234 VLOG(1) << "Caching CLD data file information.";
237 g_cached_file = file.release(); 235 g_cached_file = file.release();
238 g_cached_data_offset = data_offset; 236 g_cached_data_offset = data_offset;
239 g_cached_data_length = data_length; 237 g_cached_data_length = data_length;
240 } 238 }
241 } 239 }
242 } 240 }
243 241
244 } // namespace translate 242 } // namespace translate
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698