1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 file,
5  * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 #include "GMPCrashHelperHolder.h"
8 #include "GMPService.h"
9 #include "mozilla/RefPtr.h"
10 #include "nsPIDOMWindow.h"
11 #include "mozilla/ipc/ProtocolUtils.h"
12 
13 namespace mozilla {
14 
SetCrashHelper(GMPCrashHelper * aHelper)15 void GMPCrashHelperHolder::SetCrashHelper(GMPCrashHelper* aHelper) {
16   mCrashHelper = aHelper;
17 }
18 
GetCrashHelper()19 GMPCrashHelper* GMPCrashHelperHolder::GetCrashHelper() { return mCrashHelper; }
20 
MaybeDisconnect(bool aAbnormalShutdown)21 void GMPCrashHelperHolder::MaybeDisconnect(bool aAbnormalShutdown) {
22   if (!aAbnormalShutdown) {
23     RefPtr<gmp::GeckoMediaPluginService> service(
24         gmp::GeckoMediaPluginService::GetGeckoMediaPluginService());
25     service->DisconnectCrashHelper(GetCrashHelper());
26   }
27 }
28 
29 }  // namespace mozilla
30