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

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
« no previous file with comments | « components/nacl/loader/nacl_listener.cc ('k') | ppapi/api/private/ppb_nacl_private.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 if (!host) 99 if (!host)
100 return 0; 100 return 0;
101 return host->GetRoutingIDForWidget(instance); 101 return host->GetRoutingIDForWidget(instance);
102 } 102 }
103 103
104 // Launch NaCl's sel_ldr process. 104 // Launch NaCl's sel_ldr process.
105 void LaunchSelLdr(PP_Instance instance, 105 void LaunchSelLdr(PP_Instance instance,
106 const char* alleged_url, 106 const char* alleged_url,
107 PP_Bool uses_irt, 107 PP_Bool uses_irt,
108 PP_Bool uses_ppapi, 108 PP_Bool uses_ppapi,
109 PP_Bool uses_nonsfi_mode,
109 PP_Bool enable_ppapi_dev, 110 PP_Bool enable_ppapi_dev,
110 PP_Bool enable_dyncode_syscalls, 111 PP_Bool enable_dyncode_syscalls,
111 PP_Bool enable_exception_handling, 112 PP_Bool enable_exception_handling,
112 PP_Bool enable_crash_throttling, 113 PP_Bool enable_crash_throttling,
113 void* imc_handle, 114 void* imc_handle,
114 struct PP_Var* error_message, 115 struct PP_Var* error_message,
115 PP_CompletionCallback callback) { 116 PP_CompletionCallback callback) {
116 CHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()-> 117 CHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->
117 BelongsToCurrentThread()); 118 BelongsToCurrentThread());
118 119
(...skipping 29 matching lines...) Expand all
148 instance_info.permissions = 149 instance_info.permissions =
149 ppapi::PpapiPermissions::GetForCommandLine(perm_bits); 150 ppapi::PpapiPermissions::GetForCommandLine(perm_bits);
150 std::string error_message_string; 151 std::string error_message_string;
151 nacl::NaClLaunchResult launch_result; 152 nacl::NaClLaunchResult launch_result;
152 153
153 if (!sender->Send(new NaClHostMsg_LaunchNaCl( 154 if (!sender->Send(new NaClHostMsg_LaunchNaCl(
154 nacl::NaClLaunchParams(instance_info.url.spec(), 155 nacl::NaClLaunchParams(instance_info.url.spec(),
155 routing_id, 156 routing_id,
156 perm_bits, 157 perm_bits,
157 PP_ToBool(uses_irt), 158 PP_ToBool(uses_irt),
159 PP_ToBool(uses_nonsfi_mode),
158 PP_ToBool(enable_dyncode_syscalls), 160 PP_ToBool(enable_dyncode_syscalls),
159 PP_ToBool(enable_exception_handling), 161 PP_ToBool(enable_exception_handling),
160 PP_ToBool(enable_crash_throttling)), 162 PP_ToBool(enable_crash_throttling)),
161 &launch_result, 163 &launch_result,
162 &error_message_string))) { 164 &error_message_string))) {
163 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( 165 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
164 FROM_HERE, 166 FROM_HERE,
165 base::Bind(callback.func, callback.user_data, 167 base::Bind(callback.func, callback.user_data,
166 static_cast<int32_t>(PP_ERROR_FAILED))); 168 static_cast<int32_t>(PP_ERROR_FAILED)));
167 return; 169 return;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 int32_t GetNumberOfProcessors() { 295 int32_t GetNumberOfProcessors() {
294 int32_t num_processors; 296 int32_t num_processors;
295 IPC::Sender* sender = content::RenderThread::Get(); 297 IPC::Sender* sender = content::RenderThread::Get();
296 DCHECK(sender); 298 DCHECK(sender);
297 if(!sender->Send(new NaClHostMsg_NaClGetNumProcessors(&num_processors))) { 299 if(!sender->Send(new NaClHostMsg_NaClGetNumProcessors(&num_processors))) {
298 return 1; 300 return 1;
299 } 301 }
300 return num_processors; 302 return num_processors;
301 } 303 }
302 304
305 PP_Bool IsNonSFIModeEnabled() {
306 #if defined(OS_LINUX)
307 return PP_FromBool(CommandLine::ForCurrentProcess()->HasSwitch(
308 switches::kEnableNaClNonSfiMode));
309 #else
310 return PP_FALSE;
311 #endif
312 }
313
303 int32_t GetNexeFd(PP_Instance instance, 314 int32_t GetNexeFd(PP_Instance instance,
304 const char* pexe_url, 315 const char* pexe_url,
305 uint32_t abi_version, 316 uint32_t abi_version,
306 uint32_t opt_level, 317 uint32_t opt_level,
307 const char* last_modified, 318 const char* last_modified,
308 const char* etag, 319 const char* etag,
309 PP_Bool has_no_store_header, 320 PP_Bool has_no_store_header,
310 const char* sandbox_isa, 321 const char* sandbox_isa,
311 const char* extra_flags, 322 const char* extra_flags,
312 PP_Bool* is_hit, 323 PP_Bool* is_hit,
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 556
546 const PPB_NaCl_Private nacl_interface = { 557 const PPB_NaCl_Private nacl_interface = {
547 &LaunchSelLdr, 558 &LaunchSelLdr,
548 &StartPpapiProxy, 559 &StartPpapiProxy,
549 &UrandomFD, 560 &UrandomFD,
550 &Are3DInterfacesDisabled, 561 &Are3DInterfacesDisabled,
551 &BrokerDuplicateHandle, 562 &BrokerDuplicateHandle,
552 &GetReadonlyPnaclFD, 563 &GetReadonlyPnaclFD,
553 &CreateTemporaryFile, 564 &CreateTemporaryFile,
554 &GetNumberOfProcessors, 565 &GetNumberOfProcessors,
566 &IsNonSFIModeEnabled,
555 &GetNexeFd, 567 &GetNexeFd,
556 &ReportTranslationFinished, 568 &ReportTranslationFinished,
557 &OpenNaClExecutable, 569 &OpenNaClExecutable,
558 &DispatchEvent, 570 &DispatchEvent,
559 &SetReadOnlyProperty, 571 &SetReadOnlyProperty,
560 &ReportLoadError, 572 &ReportLoadError,
561 &InstanceDestroyed, 573 &InstanceDestroyed,
562 &NaClDebugStubEnabled 574 &NaClDebugStubEnabled
563 }; 575 };
564 576
565 } // namespace 577 } // namespace
566 578
567 namespace nacl { 579 namespace nacl {
568 580
569 const PPB_NaCl_Private* GetNaClPrivateInterface() { 581 const PPB_NaCl_Private* GetNaClPrivateInterface() {
570 return &nacl_interface; 582 return &nacl_interface;
571 } 583 }
572 584
573 } // namespace nacl 585 } // namespace nacl
574 586
575 #endif // DISABLE_NACL 587 #endif // DISABLE_NACL
OLDNEW
« no previous file with comments | « components/nacl/loader/nacl_listener.cc ('k') | ppapi/api/private/ppb_nacl_private.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698