Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 // This file exports a single function used to setup the | 7 // This file exports a single function used to setup the |
| 8 // multimedia sub-system for use with sel_universal | 8 // multimedia sub-system for use with sel_universal |
| 9 // It was inpspired by src/trusted/plugin/srpc/multimedia_socket.cc | 9 // It was inpspired by src/trusted/plugin/srpc/multimedia_socket.cc |
| 10 // On the untrusted side it interface with: src/untrusted/av/nacl_av.c | 10 // On the untrusted side it interface with: src/untrusted/av/nacl_av.c |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 #include "ppapi/c/ppb_audio_config.h" | 34 #include "ppapi/c/ppb_audio_config.h" |
| 35 #include "ppapi/c/ppb_image_data.h" | 35 #include "ppapi/c/ppb_image_data.h" |
| 36 | 36 |
| 37 #include "native_client/src/shared/imc/nacl_imc.h" | 37 #include "native_client/src/shared/imc/nacl_imc.h" |
| 38 #include "native_client/src/shared/platform/nacl_check.h" | 38 #include "native_client/src/shared/platform/nacl_check.h" |
| 39 #include "native_client/src/shared/srpc/nacl_srpc.h" | 39 #include "native_client/src/shared/srpc/nacl_srpc.h" |
| 40 #include "native_client/src/trusted/desc/nacl_desc_sync_socket.h" | 40 #include "native_client/src/trusted/desc/nacl_desc_sync_socket.h" |
| 41 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" | 41 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" |
| 42 | 42 |
| 43 #include "native_client/src/trusted/sel_universal/rpc_universal.h" | 43 #include "native_client/src/trusted/sel_universal/rpc_universal.h" |
| 44 #include "native_client/src/trusted/sel_universal/multimedia.h" | 44 #include "native_client/src/trusted/sel_universal/primitives.h" |
| 45 #include "native_client/src/trusted/sel_universal/parsing.h" | 45 #include "native_client/src/trusted/sel_universal/parsing.h" |
| 46 #include "native_client/src/trusted/sel_universal/pepper_emu.h" | 46 #include "native_client/src/trusted/sel_universal/pepper_emu.h" |
| 47 #include "native_client/src/trusted/sel_universal/srpc_helper.h" | 47 #include "native_client/src/trusted/sel_universal/srpc_helper.h" |
| 48 | 48 |
| 49 using nacl::DescWrapperFactory; | 49 using nacl::DescWrapperFactory; |
| 50 using nacl::DescWrapper; | 50 using nacl::DescWrapper; |
| 51 | 51 |
| 52 // ====================================================================== | 52 // ====================================================================== |
| 53 const int kInvalidInstance = 0; | 53 const int kInvalidInstance = 0; |
| 54 const int kInvalidHandle = 0; | 54 const int kInvalidHandle = 0; |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 452 CHECK(handle == Global.handle_audio_config); | 452 CHECK(handle == Global.handle_audio_config); |
| 453 | 453 |
| 454 outs[0]->u.ival = Global.sample_frame_count; | 454 outs[0]->u.ival = Global.sample_frame_count; |
| 455 rpc->result = NACL_SRPC_RESULT_OK; | 455 rpc->result = NACL_SRPC_RESULT_OK; |
| 456 done->Run(done); | 456 done->Run(done); |
| 457 } | 457 } |
| 458 | 458 |
| 459 | 459 |
| 460 // TODO(robertm): rename this to HandlerPepperEmuInitialize | 460 // TODO(robertm): rename this to HandlerPepperEmuInitialize |
| 461 #define TUPLE(a, b) #a #b, a | 461 #define TUPLE(a, b) #a #b, a |
| 462 bool HandlerSDLInitialize(NaClCommandLoop* ncl, const vector<string>& args) { | 462 bool HandlerPepperEmuInitialize(NaClCommandLoop* ncl, |
| 463 const vector<string>& args) { | |
| 463 NaClLog(LOG_INFO, "HandlerSDLInitialize\n"); | 464 NaClLog(LOG_INFO, "HandlerSDLInitialize\n"); |
| 464 if (args.size() < 5) { | 465 if (args.size() < 5) { |
| 465 NaClLog(LOG_ERROR, "Insufficient arguments to 'rpc' command.\n"); | 466 NaClLog(LOG_ERROR, "Insufficient arguments to 'rpc' command.\n"); |
| 466 return false; | 467 return false; |
| 467 } | 468 } |
| 468 | 469 |
| 469 UNREFERENCED_PARAMETER(ncl); | 470 UNREFERENCED_PARAMETER(ncl); |
| 470 // TODO(robertm): factor the audio video rpcs into a different file | 471 // TODO(robertm): factor the audio video rpcs into a different file |
| 471 // and initialize them via say PepperEmuInitAV() | 472 // and initialize them via say PepperEmuInitAV() |
| 472 ncl->AddUpcallRpc(TUPLE(PPB_Audio_Create, :ii:i)); | 473 ncl->AddUpcallRpc(TUPLE(PPB_Audio_Create, :ii:i)); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 568 #endif | 569 #endif |
| 569 return true; | 570 return true; |
| 570 } | 571 } |
| 571 } | 572 } |
| 572 | 573 |
| 573 // uncomment the line below if you want to use a non-blocking | 574 // uncomment the line below if you want to use a non-blocking |
| 574 // event processing loop. | 575 // event processing loop. |
| 575 // This can be sometime useful for debugging but is wasting cycles | 576 // This can be sometime useful for debugging but is wasting cycles |
| 576 // #define USE_POLLING | 577 // #define USE_POLLING |
| 577 | 578 |
| 578 bool HandlerSDLEventLoop(NaClCommandLoop* ncl, const vector<string>& args) { | 579 bool HandlerPepperEmuEventLoop(NaClCommandLoop* ncl, |
| 580 const vector<string>& args) { | |
|
Sang Ahn
2011/06/09 20:34:48
Emu is short for Emulator?
robertm
2011/06/09 21:02:21
yes
On 2011/06/09 20:34:48, Sang Ahn wrote:
| |
| 579 NaClLog(LOG_INFO, "HandlerSDLEventLoop\n"); | 581 NaClLog(LOG_INFO, "HandlerSDLEventLoop\n"); |
| 580 UNREFERENCED_PARAMETER(args); | 582 UNREFERENCED_PARAMETER(args); |
| 581 UNREFERENCED_PARAMETER(ncl); | 583 UNREFERENCED_PARAMETER(ncl); |
| 582 PP_InputEvent event; | 584 PP_InputEvent event; |
| 583 while (true) { | 585 while (true) { |
| 584 NaClLog(1, "event wait\n"); | 586 NaClLog(1, "event wait\n"); |
| 585 if (!GetNextEvent(&event)) { | 587 if (!GetNextEvent(&event)) { |
| 586 continue; | 588 continue; |
| 587 } | 589 } |
| 588 | 590 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 683 | 685 |
| 684 void ReplayPPAPIEvents(std::string filename) { | 686 void ReplayPPAPIEvents(std::string filename) { |
| 685 NaClLog(LOG_INFO, "replaying events from %s\n", filename.c_str()); | 687 NaClLog(LOG_INFO, "replaying events from %s\n", filename.c_str()); |
| 686 MakeInvalidEvent(&Global.next_sync_event); | 688 MakeInvalidEvent(&Global.next_sync_event); |
| 687 Global.event_replay_stream.open(filename.c_str(), | 689 Global.event_replay_stream.open(filename.c_str(), |
| 688 std::ios::in | std::ios::binary); | 690 std::ios::in | std::ios::binary); |
| 689 if (!Global.event_replay_stream.is_open()) { | 691 if (!Global.event_replay_stream.is_open()) { |
| 690 NaClLog(LOG_FATAL, "Cannot open %s\n", filename.c_str()); | 692 NaClLog(LOG_FATAL, "Cannot open %s\n", filename.c_str()); |
| 691 } | 693 } |
| 692 } | 694 } |
| OLD | NEW |