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

Side by Side Diff: chrome/renderer/chrome_ppapi_interfaces.cc

Issue 10134029: NaCl: Don't pass the NaCl process's Windows handle to the renderer process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use C-style cast Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/render_messages.h ('k') | 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 "chrome/renderer/chrome_ppapi_interfaces.h" 5 #include "chrome/renderer/chrome_ppapi_interfaces.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/rand_util_c.h" 10 #include "base/rand_util_c.h"
(...skipping 24 matching lines...) Expand all
35 namespace { 35 namespace {
36 base::LazyInstance<scoped_refptr<IPC::SyncMessageFilter> > 36 base::LazyInstance<scoped_refptr<IPC::SyncMessageFilter> >
37 g_background_thread_sender = LAZY_INSTANCE_INITIALIZER; 37 g_background_thread_sender = LAZY_INSTANCE_INITIALIZER;
38 } // namespace 38 } // namespace
39 39
40 // Launch NaCl's sel_ldr process. 40 // Launch NaCl's sel_ldr process.
41 bool LaunchSelLdr(const char* alleged_url, int socket_count, 41 bool LaunchSelLdr(const char* alleged_url, int socket_count,
42 void* imc_handles, void* nacl_process_handle, 42 void* imc_handles, void* nacl_process_handle,
43 int* nacl_process_id) { 43 int* nacl_process_id) {
44 std::vector<nacl::FileDescriptor> sockets; 44 std::vector<nacl::FileDescriptor> sockets;
45 base::ProcessHandle nacl_process;
46 IPC::Message::Sender* sender = RenderThread::Get(); 45 IPC::Message::Sender* sender = RenderThread::Get();
47 if (sender == NULL) { 46 if (sender == NULL) {
48 sender = g_background_thread_sender.Pointer()->get(); 47 sender = g_background_thread_sender.Pointer()->get();
49 } 48 }
50 if (!sender->Send( 49 if (!sender->Send(
51 new ChromeViewHostMsg_LaunchNaCl( 50 new ChromeViewHostMsg_LaunchNaCl(
52 GURL(alleged_url), 51 GURL(alleged_url), socket_count, &sockets))) {
53 socket_count,
54 &sockets,
55 &nacl_process,
56 reinterpret_cast<base::ProcessId*>(nacl_process_id)))) {
57 return false; 52 return false;
58 } 53 }
59 CHECK(static_cast<int>(sockets.size()) == socket_count); 54 CHECK(static_cast<int>(sockets.size()) == socket_count);
60 for (int i = 0; i < socket_count; i++) { 55 for (int i = 0; i < socket_count; i++) {
61 static_cast<nacl::Handle*>(imc_handles)[i] = 56 static_cast<nacl::Handle*>(imc_handles)[i] =
62 nacl::ToNativeHandle(sockets[i]); 57 nacl::ToNativeHandle(sockets[i]);
63 } 58 }
64 *static_cast<nacl::Handle*>(nacl_process_handle) = nacl_process; 59 // TODO(mseaborn): Remove the arguments nacl_process_handle and
60 // nacl_process_id from the interface.
61 *reinterpret_cast<base::ProcessHandle*>(nacl_process_handle) =
62 (base::ProcessHandle) -1;
Mark Seaborn 2012/04/23 20:04:16 As I discussed with David, I had to change this to
63 *nacl_process_id = 0;
65 return true; 64 return true;
66 } 65 }
67 66
68 int UrandomFD(void) { 67 int UrandomFD(void) {
69 #if defined(OS_POSIX) 68 #if defined(OS_POSIX)
70 return GetUrandomFD(); 69 return GetUrandomFD();
71 #else 70 #else
72 return 0; 71 return 0;
73 #endif 72 #endif
74 } 73 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 #if !defined(DISABLE_NACL) 117 #if !defined(DISABLE_NACL)
119 if (interface_name == PPB_NACL_PRIVATE_INTERFACE) 118 if (interface_name == PPB_NACL_PRIVATE_INTERFACE)
120 return chrome::PPB_NaCl_Impl::GetInterface(); 119 return chrome::PPB_NaCl_Impl::GetInterface();
121 #endif // DISABLE_NACL 120 #endif // DISABLE_NACL
122 if (interface_name == PPB_PDF_INTERFACE) 121 if (interface_name == PPB_PDF_INTERFACE)
123 return chrome::PPB_PDF_Impl::GetInterface(); 122 return chrome::PPB_PDF_Impl::GetInterface();
124 return NULL; 123 return NULL;
125 } 124 }
126 125
127 } // namespace chrome 126 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/common/render_messages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698