OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "experimental/conways_life/life_application.h" | |
6 #include "ppapi/cpp/module.h" | |
7 | |
8 namespace life { | |
9 // The Module class. The browser calls the CreateInstance() method to create | |
10 // an instance of you NaCl module on the web page. The browser creates a new | |
11 // instance for each <embed> tag with type="application/x-nacl". | |
12 class LifeModule : public pp::Module { | |
13 public: | |
14 LifeModule() : pp::Module() {} | |
15 virtual ~LifeModule() {} | |
16 | |
17 // Create and return a Life instance object. | |
18 virtual pp::Instance* CreateInstance(PP_Instance instance) { | |
19 return new LifeApplication(instance); | |
20 } | |
21 }; | |
22 } // namespace life | |
23 | |
24 // Factory function called by the browser when the module is first loaded. | |
25 // The browser keeps a singleton of this module. It calls the | |
26 // CreateInstance() method on the object you return to make instances. There | |
27 // is one instance per <embed> tag on the page. This is the main binding | |
28 // point for your NaCl module with the browser. | |
29 namespace pp { | |
30 Module* CreateModule() { | |
31 return new life::LifeModule(); | |
32 } | |
33 } // namespace pp | |
34 | |
OLD | NEW |