OLD | NEW |
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 /// @file file_histogram.cc | 5 /// @file file_histogram.cc |
6 /// This example demonstrates loading, running and scripting a very simple NaCl | 6 /// This example demonstrates loading, running and scripting a very simple NaCl |
7 /// module. To load the NaCl module, the browser first looks for the | 7 /// module. To load the NaCl module, the browser first looks for the |
8 /// CreateModule() factory method (at the end of this file). It calls | 8 /// CreateModule() factory method (at the end of this file). It calls |
9 /// CreateModule() once to load the module code from your .nexe. After the | 9 /// CreateModule() once to load the module code from your .nexe. After the |
10 /// .nexe code is loaded, CreateModule() is not called again. | 10 /// .nexe code is loaded, CreateModule() is not called again. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 namespace { | 50 namespace { |
51 | 51 |
52 const uint32_t kBlue = 0xff4040ffu; | 52 const uint32_t kBlue = 0xff4040ffu; |
53 const uint32_t kBlack = 0xff000000u; | 53 const uint32_t kBlack = 0xff000000u; |
54 const size_t kHistogramSize = 256u; | 54 const size_t kHistogramSize = 256u; |
55 | 55 |
56 } // namespace | 56 } // namespace |
57 | 57 |
58 /// The Instance class. One of these exists for each instance of your NaCl | 58 /// The Instance class. One of these exists for each instance of your NaCl |
59 /// module on the web page. The browser will ask the Module object to create | 59 /// module on the web page. The browser will ask the Module object to create |
60 /// a new Instance for each occurence of the <embed> tag that has these | 60 /// a new Instance for each occurrence of the <embed> tag that has these |
61 /// attributes: | 61 /// attributes: |
62 /// type="application/x-nacl" | 62 /// type="application/x-nacl" |
63 /// src="file_histogram.nmf" | 63 /// src="file_histogram.nmf" |
64 class FileHistogramInstance : public pp::Instance { | 64 class FileHistogramInstance : public pp::Instance { |
65 public: | 65 public: |
66 /// The constructor creates the plugin-side instance. | 66 /// The constructor creates the plugin-side instance. |
67 /// @param[in] instance the handle to the browser-side plugin instance. | 67 /// @param[in] instance the handle to the browser-side plugin instance. |
68 explicit FileHistogramInstance(PP_Instance instance) | 68 explicit FileHistogramInstance(PP_Instance instance) |
69 : pp::Instance(instance), | 69 : pp::Instance(instance), |
70 callback_factory_(this), | 70 callback_factory_(this), |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 namespace pp { | 228 namespace pp { |
229 /// Factory function called by the browser when the module is first loaded. | 229 /// Factory function called by the browser when the module is first loaded. |
230 /// The browser keeps a singleton of this module. It calls the | 230 /// The browser keeps a singleton of this module. It calls the |
231 /// CreateInstance() method on the object you return to make instances. There | 231 /// CreateInstance() method on the object you return to make instances. There |
232 /// is one instance per <embed> tag on the page. This is the main binding | 232 /// is one instance per <embed> tag on the page. This is the main binding |
233 /// point for your NaCl module with the browser. | 233 /// point for your NaCl module with the browser. |
234 Module* CreateModule() { | 234 Module* CreateModule() { |
235 return new FileHistogramModule(); | 235 return new FileHistogramModule(); |
236 } | 236 } |
237 } // namespace pp | 237 } // namespace pp |
OLD | NEW |