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