| 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 22 matching lines...) Expand all Loading... |
| 33 #include "ppapi/cpp/instance.h" | 33 #include "ppapi/cpp/instance.h" |
| 34 #include "ppapi/cpp/module.h" | 34 #include "ppapi/cpp/module.h" |
| 35 #include "ppapi/cpp/var.h" | 35 #include "ppapi/cpp/var.h" |
| 36 #include "ppapi/cpp/var_array_buffer.h" | 36 #include "ppapi/cpp/var_array_buffer.h" |
| 37 #include "ppapi/utility/completion_callback_factory.h" | 37 #include "ppapi/utility/completion_callback_factory.h" |
| 38 | 38 |
| 39 #ifdef WIN32 | 39 #ifdef WIN32 |
| 40 #undef min | 40 #undef min |
| 41 #undef max | 41 #undef max |
| 42 #undef PostMessage | 42 #undef PostMessage |
| 43 |
| 44 // Allow 'this' in initializer list |
| 45 #pragma warning(disable : 4355) |
| 46 // Disable warning about behaviour of array initialization. |
| 47 #pragma warning(disable : 4351) |
| 43 #endif | 48 #endif |
| 44 | 49 |
| 45 namespace { | 50 namespace { |
| 46 | 51 |
| 47 const uint32_t kBlue = 0xff4040ffu; | 52 const uint32_t kBlue = 0xff4040ffu; |
| 48 const uint32_t kBlack = 0xff000000u; | 53 const uint32_t kBlack = 0xff000000u; |
| 49 const size_t kHistogramSize = 256u; | 54 const size_t kHistogramSize = 256u; |
| 50 | 55 |
| 51 } // namespace | 56 } // namespace |
| 52 | 57 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 namespace pp { | 228 namespace pp { |
| 224 /// 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. |
| 225 /// The browser keeps a singleton of this module. It calls the | 230 /// The browser keeps a singleton of this module. It calls the |
| 226 /// CreateInstance() method on the object you return to make instances. There | 231 /// CreateInstance() method on the object you return to make instances. There |
| 227 /// 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 |
| 228 /// point for your NaCl module with the browser. | 233 /// point for your NaCl module with the browser. |
| 229 Module* CreateModule() { | 234 Module* CreateModule() { |
| 230 return new FileHistogramModule(); | 235 return new FileHistogramModule(); |
| 231 } | 236 } |
| 232 } // namespace pp | 237 } // namespace pp |
| OLD | NEW |