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

Side by Side Diff: components/nacl/renderer/ppb_nacl_private_impl.cc

Issue 1512733003: PNaCl: Use Chrome IPC to talk to the linker process, instead of SRPC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 4 years, 11 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 "components/nacl/renderer/ppb_nacl_private_impl.h" 5 #include "components/nacl/renderer/ppb_nacl_private_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <numeric> 9 #include <numeric>
10 #include <string> 10 #include <string>
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 STATICALLY_CHECK_NACLAPPPROCESSTYPE_EQ(PP_PNACL_TRANSLATOR_PROCESS_TYPE, 382 STATICALLY_CHECK_NACLAPPPROCESSTYPE_EQ(PP_PNACL_TRANSLATOR_PROCESS_TYPE,
383 kPNaClTranslatorProcessType); 383 kPNaClTranslatorProcessType);
384 STATICALLY_CHECK_NACLAPPPROCESSTYPE_EQ(PP_NUM_NACL_PROCESS_TYPES, 384 STATICALLY_CHECK_NACLAPPPROCESSTYPE_EQ(PP_NUM_NACL_PROCESS_TYPES,
385 kNumNaClProcessTypes); 385 kNumNaClProcessTypes);
386 #undef STATICALLY_CHECK_NACLAPPPROCESSTYPE_EQ 386 #undef STATICALLY_CHECK_NACLAPPPROCESSTYPE_EQ
387 DCHECK(pp_process_type > PP_UNKNOWN_NACL_PROCESS_TYPE && 387 DCHECK(pp_process_type > PP_UNKNOWN_NACL_PROCESS_TYPE &&
388 pp_process_type < PP_NUM_NACL_PROCESS_TYPES); 388 pp_process_type < PP_NUM_NACL_PROCESS_TYPES);
389 return static_cast<NaClAppProcessType>(pp_process_type); 389 return static_cast<NaClAppProcessType>(pp_process_type);
390 } 390 }
391 391
392 // A dummy IPC::Listener object with a no-op message handler. We use
393 // this with an IPC::SyncChannel where we only send synchronous
394 // messages and don't need to handle any messages other than sync
395 // replies.
396 class NoOpListener : public IPC::Listener {
397 public:
398 bool OnMessageReceived(const IPC::Message& message) override { return false; }
399 void OnChannelError() override {}
400 };
401
392 // Launch NaCl's sel_ldr process. 402 // Launch NaCl's sel_ldr process.
393 void LaunchSelLdr(PP_Instance instance, 403 void LaunchSelLdr(PP_Instance instance,
394 PP_Bool main_service_runtime, 404 PP_Bool main_service_runtime,
395 const char* alleged_url, 405 const char* alleged_url,
396 const PP_NaClFileInfo* nexe_file_info, 406 const PP_NaClFileInfo* nexe_file_info,
397 PP_Bool uses_nonsfi_mode, 407 PP_Bool uses_nonsfi_mode,
398 PP_NaClAppProcessType pp_process_type, 408 PP_NaClAppProcessType pp_process_type,
399 void* imc_handle, 409 void* imc_handle,
410 scoped_ptr<IPC::SyncChannel>* translator_channel,
411 base::ProcessId* process_id,
400 PP_CompletionCallback callback) { 412 PP_CompletionCallback callback) {
401 CHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()-> 413 CHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->
402 BelongsToCurrentThread()); 414 BelongsToCurrentThread());
403 NaClAppProcessType process_type = PP_ToNaClAppProcessType(pp_process_type); 415 NaClAppProcessType process_type = PP_ToNaClAppProcessType(pp_process_type);
404 // Create the manifest service proxy here, so on error case, it will be 416 // Create the manifest service proxy here, so on error case, it will be
405 // destructed (without passing it to ManifestServiceChannel). 417 // destructed (without passing it to ManifestServiceChannel).
406 scoped_ptr<ManifestServiceChannel::Delegate> manifest_service_proxy( 418 scoped_ptr<ManifestServiceChannel::Delegate> manifest_service_proxy(
407 new ManifestServiceProxy(instance, process_type)); 419 new ManifestServiceProxy(instance, process_type));
408 420
409 IPC::Sender* sender = content::RenderThread::Get(); 421 IPC::Sender* sender = content::RenderThread::Get();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 static_cast<int32_t>(PP_ERROR_FAILED))); 521 static_cast<int32_t>(PP_ERROR_FAILED)));
510 return; 522 return;
511 } 523 }
512 524
513 instance_info.channel_handle = launch_result.ppapi_ipc_channel_handle; 525 instance_info.channel_handle = launch_result.ppapi_ipc_channel_handle;
514 instance_info.plugin_pid = launch_result.plugin_pid; 526 instance_info.plugin_pid = launch_result.plugin_pid;
515 instance_info.plugin_child_id = launch_result.plugin_child_id; 527 instance_info.plugin_child_id = launch_result.plugin_child_id;
516 528
517 // Don't save instance_info if channel handle is invalid. 529 // Don't save instance_info if channel handle is invalid.
518 if (IsValidChannelHandle(instance_info.channel_handle)) { 530 if (IsValidChannelHandle(instance_info.channel_handle)) {
519 NaClPluginInstance* nacl_plugin_instance = GetNaClPluginInstance(instance); 531 if (process_type == kPNaClTranslatorProcessType) {
520 nacl_plugin_instance->instance_info.reset(new InstanceInfo(instance_info)); 532 // Return an IPC channel which allows communicating with a PNaCl
533 // translator process.
534 *translator_channel = IPC::SyncChannel::Create(
535 instance_info.channel_handle,
536 IPC::Channel::MODE_CLIENT,
537 new NoOpListener,
538 content::RenderThread::Get()->GetIOMessageLoopProxy(),
539 true,
540 content::RenderThread::Get()->GetShutdownEvent());
541 *process_id = launch_result.plugin_pid;
542 } else {
543 // Save the channel handle for when StartPpapiProxy() is called.
544 NaClPluginInstance* nacl_plugin_instance =
545 GetNaClPluginInstance(instance);
546 nacl_plugin_instance->instance_info.reset(
547 new InstanceInfo(instance_info));
548 }
521 } 549 }
522 550
523 *(static_cast<NaClHandle*>(imc_handle)) = 551 *(static_cast<NaClHandle*>(imc_handle)) =
524 IPC::PlatformFileForTransitToPlatformFile( 552 IPC::PlatformFileForTransitToPlatformFile(
525 launch_result.imc_channel_handle); 553 launch_result.imc_channel_handle);
526 554
527 // Store the crash information shared memory handle. 555 // Store the crash information shared memory handle.
528 load_manager->set_crash_info_shmem_handle( 556 load_manager->set_crash_info_shmem_handle(
529 launch_result.crash_info_shmem_handle); 557 launch_result.crash_info_shmem_handle);
530 558
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 &StreamPexe 1752 &StreamPexe
1725 }; 1753 };
1726 1754
1727 } // namespace 1755 } // namespace
1728 1756
1729 const PPB_NaCl_Private* GetNaClPrivateInterface() { 1757 const PPB_NaCl_Private* GetNaClPrivateInterface() {
1730 return &nacl_interface; 1758 return &nacl_interface;
1731 } 1759 }
1732 1760
1733 } // namespace nacl 1761 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/renderer/ppb_nacl_private.h ('k') | ppapi/nacl_irt/irt_pnacl_translator_link.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698