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

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

Issue 807193006: Remove nonsfi token workaround. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « components/nacl/renderer/nexe_load_manager.cc ('k') | ppapi/nacl_irt/manifest_service.cc » ('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 #include <numeric> 7 #include <numeric>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 process_type), 369 process_type),
370 &launch_result, 370 &launch_result,
371 &error_message_string))) { 371 &error_message_string))) {
372 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( 372 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
373 FROM_HERE, 373 FROM_HERE,
374 base::Bind(callback.func, callback.user_data, 374 base::Bind(callback.func, callback.user_data,
375 static_cast<int32_t>(PP_ERROR_FAILED))); 375 static_cast<int32_t>(PP_ERROR_FAILED)));
376 return; 376 return;
377 } 377 }
378 378
379 NexeLoadManager* load_manager = NexeLoadManager::Get(instance);
380 DCHECK(load_manager);
381 if (!load_manager) {
382 PostPPCompletionCallback(callback, PP_ERROR_FAILED);
383 base::SharedMemory::CloseHandle(launch_result.crash_info_shmem_handle);
384 return;
385 }
386 load_manager->set_nonsfi(PP_ToBool(uses_nonsfi_mode));
387
379 if (!error_message_string.empty()) { 388 if (!error_message_string.empty()) {
380 if (PP_ToBool(main_service_runtime)) { 389 if (PP_ToBool(main_service_runtime)) {
381 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); 390 load_manager->ReportLoadError(PP_NACL_ERROR_SEL_LDR_LAUNCH,
382 if (load_manager) { 391 "ServiceRuntime: failed to start",
383 load_manager->ReportLoadError(PP_NACL_ERROR_SEL_LDR_LAUNCH, 392 error_message_string);
384 "ServiceRuntime: failed to start",
385 error_message_string);
386 }
387 } 393 }
388 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( 394 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
389 FROM_HERE, 395 FROM_HERE,
390 base::Bind(callback.func, callback.user_data, 396 base::Bind(callback.func, callback.user_data,
391 static_cast<int32_t>(PP_ERROR_FAILED))); 397 static_cast<int32_t>(PP_ERROR_FAILED)));
392 return; 398 return;
393 } 399 }
394 result_socket = launch_result.imc_channel_handle; 400 result_socket = launch_result.imc_channel_handle;
395 instance_info.channel_handle = launch_result.ppapi_ipc_channel_handle; 401 instance_info.channel_handle = launch_result.ppapi_ipc_channel_handle;
396 instance_info.plugin_pid = launch_result.plugin_pid; 402 instance_info.plugin_pid = launch_result.plugin_pid;
397 instance_info.plugin_child_id = launch_result.plugin_child_id; 403 instance_info.plugin_child_id = launch_result.plugin_child_id;
398 404
399 // Don't save instance_info if channel handle is invalid. 405 // Don't save instance_info if channel handle is invalid.
400 if (IsValidChannelHandle(instance_info.channel_handle)) 406 if (IsValidChannelHandle(instance_info.channel_handle))
401 g_instance_info.Get()[instance] = instance_info; 407 g_instance_info.Get()[instance] = instance_info;
402 408
403 *(static_cast<NaClHandle*>(imc_handle)) = ToNativeHandle(result_socket); 409 *(static_cast<NaClHandle*>(imc_handle)) = ToNativeHandle(result_socket);
404 410
405 NexeLoadManager* load_manager = NexeLoadManager::Get(instance);
406 DCHECK(load_manager);
407 if (!load_manager) {
408 PostPPCompletionCallback(callback, PP_ERROR_FAILED);
409 base::SharedMemory::CloseHandle(launch_result.crash_info_shmem_handle);
410 return;
411 }
412
413 // Store the crash information shared memory handle. 411 // Store the crash information shared memory handle.
414 load_manager->set_crash_info_shmem_handle( 412 load_manager->set_crash_info_shmem_handle(
415 launch_result.crash_info_shmem_handle); 413 launch_result.crash_info_shmem_handle);
416 414
417 // Create the trusted plugin channel. 415 // Create the trusted plugin channel.
418 if (IsValidChannelHandle(launch_result.trusted_ipc_channel_handle)) { 416 if (IsValidChannelHandle(launch_result.trusted_ipc_channel_handle)) {
419 bool report_exit_status = PP_ToBool(main_service_runtime); 417 bool report_exit_status = PP_ToBool(main_service_runtime);
420 scoped_ptr<TrustedPluginChannel> trusted_plugin_channel( 418 scoped_ptr<TrustedPluginChannel> trusted_plugin_channel(
421 new TrustedPluginChannel( 419 new TrustedPluginChannel(
422 load_manager, 420 load_manager,
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 674
677 PP_FileHandle OpenNaClExecutable(PP_Instance instance, 675 PP_FileHandle OpenNaClExecutable(PP_Instance instance,
678 const char* file_url, 676 const char* file_url,
679 uint64_t* nonce_lo, 677 uint64_t* nonce_lo,
680 uint64_t* nonce_hi) { 678 uint64_t* nonce_hi) {
681 // Fast path only works for installed file URLs. 679 // Fast path only works for installed file URLs.
682 GURL gurl(file_url); 680 GURL gurl(file_url);
683 if (!gurl.SchemeIs("chrome-extension")) 681 if (!gurl.SchemeIs("chrome-extension"))
684 return PP_kInvalidFileHandle; 682 return PP_kInvalidFileHandle;
685 683
684 NexeLoadManager* load_manager = NexeLoadManager::Get(instance);
685 DCHECK(load_manager);
686 if (!load_manager)
687 return PP_kInvalidFileHandle;
688 if (load_manager->nonsfi())
Mark Seaborn 2015/01/12 21:25:45 So this caused a fallback to a slow path in the ca
689 return PP_kInvalidFileHandle;
690
686 content::PepperPluginInstance* plugin_instance = 691 content::PepperPluginInstance* plugin_instance =
687 content::PepperPluginInstance::Get(instance); 692 content::PepperPluginInstance::Get(instance);
688 if (!plugin_instance) 693 if (!plugin_instance)
689 return PP_kInvalidFileHandle; 694 return PP_kInvalidFileHandle;
690 // IMPORTANT: Make sure the document can request the given URL. If we don't 695 // IMPORTANT: Make sure the document can request the given URL. If we don't
691 // check, a malicious app could probe the extension system. This enforces a 696 // check, a malicious app could probe the extension system. This enforces a
692 // same-origin policy which prevents the app from requesting resources from 697 // same-origin policy which prevents the app from requesting resources from
693 // another app. 698 // another app.
694 blink::WebSecurityOrigin security_origin = 699 blink::WebSecurityOrigin security_origin =
695 plugin_instance->GetContainer()->element().document().securityOrigin(); 700 plugin_instance->GetContainer()->element().document().securityOrigin();
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 &out_file_info->token_hi); 1230 &out_file_info->token_hi);
1226 if (handle != PP_kInvalidFileHandle) { 1231 if (handle != PP_kInvalidFileHandle) {
1227 DownloadNexeCompletion(request, 1232 DownloadNexeCompletion(request,
1228 out_file_info, 1233 out_file_info,
1229 FileDownloader::SUCCESS, 1234 FileDownloader::SUCCESS,
1230 base::File(handle), 1235 base::File(handle),
1231 200); 1236 200);
1232 return; 1237 return;
1233 } 1238 }
1234 1239
1235 // The fast path didn't work, we'll fetch the file using URLLoader and write 1240 // The fast path didn't work, we'll fetch the file using URLLoader and write
Mark Seaborn 2015/01/12 21:25:45 So the reason for the performance regression was t
1236 // it to local storage. 1241 // it to local storage.
1237 base::File target_file(CreateTemporaryFile(instance)); 1242 base::File target_file(CreateTemporaryFile(instance));
1238 GURL gurl(url); 1243 GURL gurl(url);
1239 1244
1240 content::PepperPluginInstance* plugin_instance = 1245 content::PepperPluginInstance* plugin_instance =
1241 content::PepperPluginInstance::Get(instance); 1246 content::PepperPluginInstance::Get(instance);
1242 if (!plugin_instance) { 1247 if (!plugin_instance) {
1243 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( 1248 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
1244 FROM_HERE, 1249 FROM_HERE,
1245 base::Bind(callback.func, callback.user_data, 1250 base::Bind(callback.func, callback.user_data,
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 &StreamPexe 1697 &StreamPexe
1693 }; 1698 };
1694 1699
1695 } // namespace 1700 } // namespace
1696 1701
1697 const PPB_NaCl_Private* GetNaClPrivateInterface() { 1702 const PPB_NaCl_Private* GetNaClPrivateInterface() {
1698 return &nacl_interface; 1703 return &nacl_interface;
1699 } 1704 }
1700 1705
1701 } // namespace nacl 1706 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/renderer/nexe_load_manager.cc ('k') | ppapi/nacl_irt/manifest_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698