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

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

Issue 1134043002: Handle imc_handle_for_renderer error properly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 // that the renderer can send handles to the NaCl process using 733 // that the renderer can send handles to the NaCl process using
734 // BrokerDuplicateHandle(). 734 // BrokerDuplicateHandle().
735 if (RunningOnWOW64()) { 735 if (RunningOnWOW64()) {
736 if (!content::BrokerAddTargetPeer(process_->GetData().handle)) { 736 if (!content::BrokerAddTargetPeer(process_->GetData().handle)) {
737 SendErrorToRenderer("BrokerAddTargetPeer() failed"); 737 SendErrorToRenderer("BrokerAddTargetPeer() failed");
738 return; 738 return;
739 } 739 }
740 } 740 }
741 #endif 741 #endif
742 742
743 // Hereafter, we always send an IPC message with handles which, on Windows, 743 // First, create an |imc_channel_handle| for the renderer.
744 // are not closable in this process.
745 IPC::PlatformFileForTransit imc_handle_for_renderer = 744 IPC::PlatformFileForTransit imc_handle_for_renderer =
746 IPC::TakeFileHandleForProcess(socket_for_renderer_.Pass(), 745 IPC::TakeFileHandleForProcess(socket_for_renderer_.Pass(),
747 nacl_host_message_filter_->PeerHandle()); 746 nacl_host_message_filter_->PeerHandle());
747 if (imc_handle_for_renderer == IPC::InvalidPlatformFileForTransit()) {
748 // Failed to create the handle.
749 SendErrorToRenderer("imc_channel_handle creation failed.");
750 return;
751 }
748 752
753 // Hereafter, we always send an IPC message with handles including imc_handle
754 // created above which, on Windows, are not closable in this process.
749 std::string error_message; 755 std::string error_message;
750 base::SharedMemoryHandle crash_info_shmem_renderer_handle; 756 base::SharedMemoryHandle crash_info_shmem_renderer_handle;
751 if (!crash_info_shmem_.ShareToProcess(nacl_host_message_filter_->PeerHandle(), 757 if (!crash_info_shmem_.ShareToProcess(nacl_host_message_filter_->PeerHandle(),
752 &crash_info_shmem_renderer_handle)) { 758 &crash_info_shmem_renderer_handle)) {
753 // On error, we do not send "IPC::ChannelHandle"s to the renderer process. 759 // On error, we do not send "IPC::ChannelHandle"s to the renderer process.
754 // Note that some other FDs/handles still get sent to the renderer, but 760 // Note that some other FDs/handles still get sent to the renderer, but
755 // will be closed there. 761 // will be closed there.
756 ppapi_channel_handle.reset(); 762 ppapi_channel_handle.reset();
757 trusted_channel_handle.reset(); 763 trusted_channel_handle.reset();
758 manifest_service_channel_handle.reset(); 764 manifest_service_channel_handle.reset();
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 process.Pass(), info, 1254 process.Pass(), info,
1249 base::MessageLoopProxy::current(), 1255 base::MessageLoopProxy::current(),
1250 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, 1256 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker,
1251 weak_factory_.GetWeakPtr())); 1257 weak_factory_.GetWeakPtr()));
1252 return true; 1258 return true;
1253 } 1259 }
1254 } 1260 }
1255 #endif 1261 #endif
1256 1262
1257 } // namespace nacl 1263 } // namespace nacl
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698