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

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

Issue 177113009: Support non-SFI mode in NaCl manifest file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 9 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 #ifndef DISABLE_NACL 7 #ifndef DISABLE_NACL
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 if (!host) 100 if (!host)
101 return 0; 101 return 0;
102 return host->GetRoutingIDForWidget(instance); 102 return host->GetRoutingIDForWidget(instance);
103 } 103 }
104 104
105 // Launch NaCl's sel_ldr process. 105 // Launch NaCl's sel_ldr process.
106 void LaunchSelLdr(PP_Instance instance, 106 void LaunchSelLdr(PP_Instance instance,
107 const char* alleged_url, 107 const char* alleged_url,
108 PP_Bool uses_irt, 108 PP_Bool uses_irt,
109 PP_Bool uses_ppapi, 109 PP_Bool uses_ppapi,
110 PP_Bool uses_nonsfi_mode,
110 PP_Bool enable_ppapi_dev, 111 PP_Bool enable_ppapi_dev,
111 PP_Bool enable_dyncode_syscalls, 112 PP_Bool enable_dyncode_syscalls,
112 PP_Bool enable_exception_handling, 113 PP_Bool enable_exception_handling,
113 PP_Bool enable_crash_throttling, 114 PP_Bool enable_crash_throttling,
114 void* imc_handle, 115 void* imc_handle,
115 struct PP_Var* error_message, 116 struct PP_Var* error_message,
116 PP_CompletionCallback callback) { 117 PP_CompletionCallback callback) {
117 CHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()-> 118 CHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->
118 BelongsToCurrentThread()); 119 BelongsToCurrentThread());
119 120
(...skipping 29 matching lines...) Expand all
149 instance_info.permissions = 150 instance_info.permissions =
150 ppapi::PpapiPermissions::GetForCommandLine(perm_bits); 151 ppapi::PpapiPermissions::GetForCommandLine(perm_bits);
151 std::string error_message_string; 152 std::string error_message_string;
152 nacl::NaClLaunchResult launch_result; 153 nacl::NaClLaunchResult launch_result;
153 154
154 if (!sender->Send(new NaClHostMsg_LaunchNaCl( 155 if (!sender->Send(new NaClHostMsg_LaunchNaCl(
155 nacl::NaClLaunchParams(instance_info.url.spec(), 156 nacl::NaClLaunchParams(instance_info.url.spec(),
156 routing_id, 157 routing_id,
157 perm_bits, 158 perm_bits,
158 PP_ToBool(uses_irt), 159 PP_ToBool(uses_irt),
160 PP_ToBool(uses_nonsfi_mode),
159 PP_ToBool(enable_dyncode_syscalls), 161 PP_ToBool(enable_dyncode_syscalls),
160 PP_ToBool(enable_exception_handling), 162 PP_ToBool(enable_exception_handling),
161 PP_ToBool(enable_crash_throttling)), 163 PP_ToBool(enable_crash_throttling)),
162 &launch_result, 164 &launch_result,
163 &error_message_string))) { 165 &error_message_string))) {
164 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( 166 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
165 FROM_HERE, 167 FROM_HERE,
166 base::Bind(callback.func, callback.user_data, 168 base::Bind(callback.func, callback.user_data,
167 static_cast<int32_t>(PP_ERROR_FAILED))); 169 static_cast<int32_t>(PP_ERROR_FAILED)));
168 return; 170 return;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 int32_t GetNumberOfProcessors() { 297 int32_t GetNumberOfProcessors() {
296 int32_t num_processors; 298 int32_t num_processors;
297 IPC::Sender* sender = content::RenderThread::Get(); 299 IPC::Sender* sender = content::RenderThread::Get();
298 DCHECK(sender); 300 DCHECK(sender);
299 if(!sender->Send(new NaClHostMsg_NaClGetNumProcessors(&num_processors))) { 301 if(!sender->Send(new NaClHostMsg_NaClGetNumProcessors(&num_processors))) {
300 return 1; 302 return 1;
301 } 303 }
302 return num_processors; 304 return num_processors;
303 } 305 }
304 306
307 PP_Bool IsNonSFIEnabled() {
308 bool enabled;
309 IPC::Sender* sender = content::RenderThread::Get();
310 DCHECK(sender);
311 if (!sender->Send(new NaClHostMsg_NaClIsNonSFIEnabled(&enabled))) {
jvoung (off chromium) 2014/03/04 16:24:18 Btw, is this because the flag is not passed from t
Mark Seaborn 2014/03/04 16:34:00 Command line arguments don't work well for the NaC
jvoung (off chromium) 2014/03/04 16:39:42 I meant that this code could then use base/ for pa
Mark Seaborn 2014/03/04 17:29:07 Oh right, of course. :-) Yes, I agree it would ma
hidehiko 2014/03/05 08:15:33 Great to know. Done.
312 return PP_FALSE;
313 }
314 return PP_FromBool(enabled);
315 }
316
305 int32_t GetNexeFd(PP_Instance instance, 317 int32_t GetNexeFd(PP_Instance instance,
306 const char* pexe_url, 318 const char* pexe_url,
307 uint32_t abi_version, 319 uint32_t abi_version,
308 uint32_t opt_level, 320 uint32_t opt_level,
309 const char* last_modified, 321 const char* last_modified,
310 const char* etag, 322 const char* etag,
311 PP_Bool has_no_store_header, 323 PP_Bool has_no_store_header,
312 const char* sandbox_isa, 324 const char* sandbox_isa,
313 const char* extra_flags, 325 const char* extra_flags,
314 PP_Bool* is_hit, 326 PP_Bool* is_hit,
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 554
543 const PPB_NaCl_Private nacl_interface = { 555 const PPB_NaCl_Private nacl_interface = {
544 &LaunchSelLdr, 556 &LaunchSelLdr,
545 &StartPpapiProxy, 557 &StartPpapiProxy,
546 &UrandomFD, 558 &UrandomFD,
547 &Are3DInterfacesDisabled, 559 &Are3DInterfacesDisabled,
548 &BrokerDuplicateHandle, 560 &BrokerDuplicateHandle,
549 &GetReadonlyPnaclFD, 561 &GetReadonlyPnaclFD,
550 &CreateTemporaryFile, 562 &CreateTemporaryFile,
551 &GetNumberOfProcessors, 563 &GetNumberOfProcessors,
564 &IsNonSFIEnabled,
552 &GetNexeFd, 565 &GetNexeFd,
553 &ReportTranslationFinished, 566 &ReportTranslationFinished,
554 &OpenNaClExecutable, 567 &OpenNaClExecutable,
555 &DispatchEvent, 568 &DispatchEvent,
556 &SetReadOnlyProperty, 569 &SetReadOnlyProperty,
557 &ReportLoadError, 570 &ReportLoadError,
558 &InstanceDestroyed 571 &InstanceDestroyed
559 }; 572 };
560 573
561 } // namespace 574 } // namespace
562 575
563 namespace nacl { 576 namespace nacl {
564 577
565 const PPB_NaCl_Private* GetNaClPrivateInterface() { 578 const PPB_NaCl_Private* GetNaClPrivateInterface() {
566 return &nacl_interface; 579 return &nacl_interface;
567 } 580 }
568 581
569 } // namespace nacl 582 } // namespace nacl
570 583
571 #endif // DISABLE_NACL 584 #endif // DISABLE_NACL
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698