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

Side by Side Diff: native_client_sdk/src/libraries/ppapi_simple/ps_main.cc

Issue 412083002: [NaCl SDK] Allow ppapi_simple executables to run in both sel_ldr and in chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifdef __native_client__
6 #include <irt.h>
7 #include <irt_ppapi.h>
8 #endif
9
10 #include <stdio.h>
11
12 #include "nacl_io/nacl_io.h"
5 #include "ppapi/c/pp_instance.h" 13 #include "ppapi/c/pp_instance.h"
6 #include "ppapi/c/pp_module.h" 14 #include "ppapi/c/pp_module.h"
7
8 #include "ppapi_simple/ps_instance.h" 15 #include "ppapi_simple/ps_instance.h"
9 #include "ppapi_simple/ps_main.h" 16 #include "ppapi_simple/ps_main.h"
10 17
18 extern "C" int PpapiPluginMain();
11 19
12 void* PSMainCreate(PP_Instance inst, PSMainFunc_t func) { 20 void* PSMainCreate(PP_Instance inst) {
13 PSInstance* pInst = new PSInstance(inst); 21 PSInstance* pInst = new PSInstance(inst);
14 pInst->SetMain(func); 22 pInst->SetMain(PSUserMainGet());
15 return pInst; 23 return pInst;
16 } 24 }
25
26 /**
27 * main entry point for ppapi_simple applications. This differs from the
28 * regular ppapi main entry point in that it will fall back to running
29 * the user's main code in the case that the PPAPI hooks are not found.
30 * This allows ppapi_simple binary to run within chrome (with PPAPI present)
31 * and also under sel_ldr (no PPAPI).
32 */
33 int main(int argc, char* argv[]) {
34 #ifdef __native_client__
35 struct nacl_irt_ppapihook hooks;
36 if (nacl_interface_query(NACL_IRT_PPAPIHOOK_v0_1, &hooks, sizeof(hooks)) ==
37 sizeof(hooks)) {
38 return PpapiPluginMain();
39 }
40 #endif
41 // By default, or if not running in the browser we simply run the main
42 // entry point directly, on the main thread.
43 nacl_io_init();
44 return PSUserMainGet()(argc, argv);
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698