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

Side by Side Diff: components/nacl/loader/nacl_listener.cc

Issue 1090233003: Set up a NaCl load status callback to start replacing "start_module". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use the enum instead of int Created 5 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
« no previous file with comments | « components/nacl/loader/nacl_listener.h ('k') | components/nacl/renderer/DEPS » ('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/loader/nacl_listener.h" 5 #include "components/nacl/loader/nacl_listener.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 // We copy the length of the crash data to the start of the shared memory 63 // We copy the length of the crash data to the start of the shared memory
64 // segment so we know how much to copy. 64 // segment so we know how much to copy.
65 memcpy(g_listener->crash_info_shmem_memory(), &copy_bytes, sizeof(uint32_t)); 65 memcpy(g_listener->crash_info_shmem_memory(), &copy_bytes, sizeof(uint32_t));
66 66
67 memcpy((char*)g_listener->crash_info_shmem_memory() + sizeof(uint32_t), 67 memcpy((char*)g_listener->crash_info_shmem_memory() + sizeof(uint32_t),
68 data, 68 data,
69 copy_bytes); 69 copy_bytes);
70 } 70 }
71 71
72 void LoadStatusCallback(int load_status) {
73 g_listener->trusted_listener()->Send(
74 new NaClRendererMsg_ReportLoadStatus(
75 static_cast<NaClErrorCode>(load_status)));
76 }
77
72 #if defined(OS_MACOSX) 78 #if defined(OS_MACOSX)
73 79
74 // On Mac OS X, shm_open() works in the sandbox but does not give us 80 // On Mac OS X, shm_open() works in the sandbox but does not give us
75 // an FD that we can map as PROT_EXEC. Rather than doing an IPC to 81 // an FD that we can map as PROT_EXEC. Rather than doing an IPC to
76 // get an executable SHM region when CreateMemoryObject() is called, 82 // get an executable SHM region when CreateMemoryObject() is called,
77 // we preallocate one on startup, since NaCl's sel_ldr only needs one 83 // we preallocate one on startup, since NaCl's sel_ldr only needs one
78 // of them. This saves a round trip. 84 // of them. This saves a round trip.
79 85
80 base::subtle::Atomic32 g_shm_fd = -1; 86 base::subtle::Atomic32 g_shm_fd = -1;
81 87
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 #if defined(OS_LINUX) || defined(OS_MACOSX) 419 #if defined(OS_LINUX) || defined(OS_MACOSX)
414 args->debug_stub_server_bound_socket_fd = nacl::ToNativeHandle( 420 args->debug_stub_server_bound_socket_fd = nacl::ToNativeHandle(
415 params.debug_stub_server_bound_socket); 421 params.debug_stub_server_bound_socket);
416 #endif 422 #endif
417 #if defined(OS_WIN) 423 #if defined(OS_WIN)
418 args->broker_duplicate_handle_func = BrokerDuplicateHandle; 424 args->broker_duplicate_handle_func = BrokerDuplicateHandle;
419 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler; 425 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler;
420 args->debug_stub_server_port_selected_handler_func = 426 args->debug_stub_server_port_selected_handler_func =
421 DebugStubPortSelectedHandler; 427 DebugStubPortSelectedHandler;
422 #endif 428 #endif
429 args->load_status_handler_func = LoadStatusCallback;
423 #if defined(OS_LINUX) 430 #if defined(OS_LINUX)
424 args->prereserved_sandbox_size = prereserved_sandbox_size_; 431 args->prereserved_sandbox_size = prereserved_sandbox_size_;
425 #endif 432 #endif
426 433
427 base::PlatformFile nexe_file = IPC::PlatformFileForTransitToPlatformFile( 434 base::PlatformFile nexe_file = IPC::PlatformFileForTransitToPlatformFile(
428 params.nexe_file); 435 params.nexe_file);
429 std::string file_path_str = params.nexe_file_path_metadata.AsUTF8Unsafe(); 436 std::string file_path_str = params.nexe_file_path_metadata.AsUTF8Unsafe();
430 args->nexe_desc = NaClDescCreateWithFilePathMetadata(nexe_file, 437 args->nexe_desc = NaClDescCreateWithFilePathMetadata(nexe_file,
431 file_path_str.c_str()); 438 file_path_str.c_str());
432 439
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 } 471 }
465 472
466 void NaClListener::OnFileTokenResolved( 473 void NaClListener::OnFileTokenResolved(
467 uint64_t token_lo, 474 uint64_t token_lo,
468 uint64_t token_hi, 475 uint64_t token_hi,
469 IPC::PlatformFileForTransit ipc_fd, 476 IPC::PlatformFileForTransit ipc_fd,
470 base::FilePath file_path) { 477 base::FilePath file_path) {
471 resolved_cb_.Run(ipc_fd, file_path); 478 resolved_cb_.Run(ipc_fd, file_path);
472 resolved_cb_.Reset(); 479 resolved_cb_.Reset();
473 } 480 }
OLDNEW
« no previous file with comments | « components/nacl/loader/nacl_listener.h ('k') | components/nacl/renderer/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698