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

Side by Side Diff: components/nacl/browser/nacl_process_host.cc

Issue 649603004: Non-SFI NaCl: Batch-open resource files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix win x64 Created 6 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/nacl/browser/nacl_process_host.h" 5 #include "components/nacl/browser/nacl_process_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 handles_for_sel_ldr->push_back(channel); 224 handles_for_sel_ldr->push_back(channel);
225 #endif 225 #endif
226 return true; 226 return true;
227 } 227 }
228 228
229 } // namespace 229 } // namespace
230 230
231 unsigned NaClProcessHost::keepalive_throttle_interval_milliseconds_ = 231 unsigned NaClProcessHost::keepalive_throttle_interval_milliseconds_ =
232 ppapi::kKeepaliveThrottleIntervalDefaultMilliseconds; 232 ppapi::kKeepaliveThrottleIntervalDefaultMilliseconds;
233 233
234 NaClProcessHost::NaClProcessHost(const GURL& manifest_url, 234 NaClProcessHost::ResourceFileInfo::ResourceFileInfo()
235 base::File nexe_file, 235 : file_token_() {
teravest 2014/11/10 20:36:11 Is this initializer necessary?
Yusuke Sato 2014/11/11 00:58:35 Since the struct does not have a constructor, I wa
236 const NaClFileToken& nexe_token, 236 }
237 ppapi::PpapiPermissions permissions, 237
238 int render_view_id, 238 NaClProcessHost::ResourceFileInfo::ResourceFileInfo(
239 uint32 permission_bits, 239 base::File file,
240 bool uses_nonsfi_mode, 240 const NaClFileToken& file_token,
241 bool off_the_record, 241 const std::string& file_key)
242 NaClAppProcessType process_type, 242 : file_(file.Pass()),
243 const base::FilePath& profile_directory) 243 file_token_(file_token),
244 file_key_(file_key) {
245 }
246
247 NaClProcessHost::ResourceFileInfo::~ResourceFileInfo() {
248 }
249
250 NaClProcessHost::ResourceFileInfo::ResourceFileInfo(RValue other)
251 : file_(other.object->file_.Pass()),
252 file_token_(other.object->file_token()),
253 file_key_(other.object->file_key()) {
254 }
255
256 NaClProcessHost::ResourceFileInfo&
257 NaClProcessHost::ResourceFileInfo::operator=(RValue other) {
258 if (this != other.object) {
259 file_ = other.object->file_.Pass();
260 file_token_ = other.object->file_token();
261 file_key_ = other.object->file_key();
262 }
263 return *this;
264 }
265
266 NaClProcessHost::NaClProcessHost(
267 const GURL& manifest_url,
268 base::File nexe_file,
269 const NaClFileToken& nexe_token,
270 scoped_ptr<NaClProcessHost::ResourceFileInfo[]> resource_files_info,
271 size_t resource_files_info_len,
272 ppapi::PpapiPermissions permissions,
273 int render_view_id,
274 uint32 permission_bits,
275 bool uses_nonsfi_mode,
276 bool off_the_record,
277 NaClAppProcessType process_type,
278 const base::FilePath& profile_directory)
244 : manifest_url_(manifest_url), 279 : manifest_url_(manifest_url),
245 nexe_file_(nexe_file.Pass()), 280 nexe_file_(nexe_file.Pass()),
246 nexe_token_(nexe_token), 281 nexe_token_(nexe_token),
282 resource_files_info_(resource_files_info.Pass()),
283 resource_files_info_len_(resource_files_info_len),
247 permissions_(permissions), 284 permissions_(permissions),
248 #if defined(OS_WIN) 285 #if defined(OS_WIN)
249 process_launched_by_broker_(false), 286 process_launched_by_broker_(false),
250 #endif 287 #endif
251 reply_msg_(NULL), 288 reply_msg_(NULL),
252 #if defined(OS_WIN) 289 #if defined(OS_WIN)
253 debug_exception_handler_requested_(false), 290 debug_exception_handler_requested_(false),
254 #endif 291 #endif
255 uses_nonsfi_mode_(uses_nonsfi_mode), 292 uses_nonsfi_mode_(uses_nonsfi_mode),
256 enable_debug_stub_(false), 293 enable_debug_stub_(false),
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 } 911 }
875 912
876 params.nexe_file = IPC::TakeFileHandleForProcess(nexe_file_.Pass(), 913 params.nexe_file = IPC::TakeFileHandleForProcess(nexe_file_.Pass(),
877 process_->GetData().handle); 914 process_->GetData().handle);
878 if (!crash_info_shmem_.ShareToProcess(process_->GetData().handle, 915 if (!crash_info_shmem_.ShareToProcess(process_->GetData().handle,
879 &params.crash_info_shmem_handle)) { 916 &params.crash_info_shmem_handle)) {
880 DLOG(ERROR) << "Failed to ShareToProcess() a shared memory buffer"; 917 DLOG(ERROR) << "Failed to ShareToProcess() a shared memory buffer";
881 return false; 918 return false;
882 } 919 }
883 920
921 if (uses_nonsfi_mode_) {
922 for (size_t i = 0; i < resource_files_info_len_; ++i) {
923 IPC::PlatformFileForTransit file = IPC::TakeFileHandleForProcess(
924 resource_files_info_[i].file().Pass(), process_->GetData().handle);
925 std::string file_key = resource_files_info_[i].file_key();
926 params.resource_files.push_back(
927 // Pass an empty base::FilePath since Non-SFI mode does not use it.
928 NaClStartParams::ResourceFileInfo(file, base::FilePath(), file_key));
929 }
930 }
931
884 process_->Send(new NaClProcessMsg_Start(params)); 932 process_->Send(new NaClProcessMsg_Start(params));
885 return true; 933 return true;
886 } 934 }
887 935
888 // This method is called when NaClProcessHostMsg_PpapiChannelCreated is 936 // This method is called when NaClProcessHostMsg_PpapiChannelCreated is
889 // received. 937 // received.
890 void NaClProcessHost::OnPpapiChannelsCreated( 938 void NaClProcessHost::OnPpapiChannelsCreated(
891 const IPC::ChannelHandle& browser_channel_handle, 939 const IPC::ChannelHandle& browser_channel_handle,
892 const IPC::ChannelHandle& ppapi_renderer_channel_handle, 940 const IPC::ChannelHandle& ppapi_renderer_channel_handle,
893 const IPC::ChannelHandle& trusted_renderer_channel_handle, 941 const IPC::ChannelHandle& trusted_renderer_channel_handle,
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 process_handle.Take(), info, 1234 process_handle.Take(), info,
1187 base::MessageLoopProxy::current(), 1235 base::MessageLoopProxy::current(),
1188 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, 1236 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker,
1189 weak_factory_.GetWeakPtr())); 1237 weak_factory_.GetWeakPtr()));
1190 return true; 1238 return true;
1191 } 1239 }
1192 } 1240 }
1193 #endif 1241 #endif
1194 1242
1195 } // namespace nacl 1243 } // namespace nacl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698