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

Side by Side Diff: native_client_sdk/src/libraries/ppapi_simple/ps.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, 4 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 #include "ppapi/c/pp_instance.h" 5 #include "ppapi/c/pp_instance.h"
6 #include "ppapi/c/pp_module.h" 6 #include "ppapi/c/pp_module.h"
7 7
8 #include "ppapi/cpp/instance.h" 8 #include "ppapi/cpp/instance.h"
9 #include "ppapi/cpp/module.h" 9 #include "ppapi/cpp/module.h"
10 10
11 #include "ppapi_simple/ps.h" 11 #include "ppapi_simple/ps.h"
12 12
13 static pp::Instance* s_Instance = NULL; 13 static pp::Instance* s_Instance = NULL;
14 14
15 PP_Instance PSGetInstanceId() { 15 PP_Instance PSGetInstanceId(void) {
16 if (s_Instance == NULL)
17 return 0;
16 return s_Instance->pp_instance(); 18 return s_Instance->pp_instance();
17 } 19 }
18 20
19 const void* PSGetInterface(const char *name) { 21 const void* PSGetInterface(const char *name) {
20 return pp::Module::Get()->GetBrowserInterface(name); 22 pp::Module* module = pp::Module::Get();
23 if (module == NULL)
24 return NULL;
25 return module->GetBrowserInterface(name);
21 } 26 }
22 27
23 28
24 // The Module class. The browser calls the CreateInstance() method to create 29 // The Module class. The browser calls the CreateInstance() method to create
25 // an instance of your NaCl module on the web page. The browser creates a new 30 // an instance of your NaCl module on the web page. The browser creates a new
26 // instance for each <embed> tag with type="application/x-nacl". 31 // instance for each <embed> tag with type="application/x-nacl".
27 class PSModule : public pp::Module { 32 class PSModule : public pp::Module {
28 public: 33 public:
29 PSModule() : pp::Module() {} 34 PSModule() : pp::Module() {}
30 virtual ~PSModule() {} 35 virtual ~PSModule() {}
(...skipping 10 matching lines...) Expand all
41 // The browser keeps a singleton of this module. It calls the 46 // The browser keeps a singleton of this module. It calls the
42 // CreateInstance() method on the object you return to make instances. There 47 // CreateInstance() method on the object you return to make instances. There
43 // is one instance per <embed> tag on the page. This is the main binding 48 // is one instance per <embed> tag on the page. This is the main binding
44 // point for your NaCl module with the browser. 49 // point for your NaCl module with the browser.
45 Module* CreateModule() { 50 Module* CreateModule() {
46 return new PSModule(); 51 return new PSModule();
47 } 52 }
48 53
49 } // namespace pp 54 } // namespace pp
50 55
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698