Home | History | Annotate | Download | only in plugin
      1 /*
      2  * Copyright (c) 2013 The Chromium Authors. All rights reserved.
      3  * Use of this source code is governed by a BSD-style license that can be
      4  * found in the LICENSE file.
      5  */
      6 
      7 #include <deque>
      8 
      9 #include "ppapi/c/private/ppb_nacl_private.h"
     10 #include "ppapi/cpp/module.h"
     11 
     12 namespace plugin {
     13 
     14 class ModulePpapi : public pp::Module {
     15  public:
     16   ModulePpapi();
     17 
     18   virtual ~ModulePpapi();
     19 
     20   virtual bool Init();
     21 
     22   virtual pp::Instance* CreateInstance(PP_Instance pp_instance);
     23 
     24   // NaCl crash throttling.  If RegisterPluginCrash is called too many times
     25   // within a time period, IsPluginUnstable reports true.  As long as
     26   // IsPluginUnstable returns true, NaCl modules will fail to load.
     27   void RegisterPluginCrash();
     28   bool IsPluginUnstable();
     29 
     30  private:
     31   bool init_was_successful_;
     32   const PPB_NaCl_Private* private_interface_;
     33 
     34   // Crash throttling support.
     35   std::deque<int64_t> crash_times_;
     36 };
     37 
     38 }  // namespace plugin
     39 
     40 
     41 namespace pp {
     42 
     43 Module* CreateModule();
     44 
     45 }  // namespace pp
     46