tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

GMPCrashHelper.h (1203B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #if !defined(GMPCrashHelper_h_)
      8 #  define GMPCrashHelper_h_
      9 
     10 #  include "MainThreadUtils.h"
     11 #  include "nsISupportsImpl.h"
     12 
     13 class nsPIDOMWindowInner;
     14 
     15 namespace mozilla {
     16 
     17 // For every GMP actor requested, the caller can specify a crash helper,
     18 // which is an object which supplies the nsPIDOMWindowInner to which we'll
     19 // dispatch the PluginCrashed event if the GMP crashes.
     20 // GMPCrashHelper has threadsafe refcounting. Its release method ensures
     21 // that instances are destroyed on the main thread.
     22 class GMPCrashHelper {
     23 public:
     24  NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_DELETE_ON_MAIN_THREAD(
     25      GMPCrashHelper);
     26 
     27  // Called on the main thread.
     28  virtual already_AddRefed<nsPIDOMWindowInner>
     29  GetPluginCrashedEventTarget() = 0;
     30 
     31 protected:
     32  virtual ~GMPCrashHelper() { MOZ_ASSERT(NS_IsMainThread()); }
     33 };
     34 
     35 }  // namespace mozilla
     36 
     37 #endif  // GMPCrashHelper_h_