MIDIManagerParent.cpp (1260B)
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 #include "mozilla/dom/MIDIManagerParent.h" 8 9 #include "mozilla/dom/MIDIPlatformService.h" 10 11 namespace mozilla::dom { 12 13 void MIDIManagerParent::ActorDestroy(ActorDestroyReason aWhy) { 14 if (MIDIPlatformService::IsRunning()) { 15 MIDIPlatformService::Get()->RemoveManager(this); 16 } 17 } 18 19 mozilla::ipc::IPCResult MIDIManagerParent::RecvRefresh() { 20 MIDIPlatformService::Get()->Refresh(); 21 return IPC_OK(); 22 } 23 24 mozilla::ipc::IPCResult MIDIManagerParent::RecvShutdown() { 25 // The two-step shutdown process here is the standard way to ensure that the 26 // child receives any messages sent by the server (since either sending or 27 // receiving __delete__ prevents any further messages from being received). 28 // This was necessary before bug 1547085 when discarded messages would 29 // trigger a crash, and is probably unnecessary now, but we leave it in place 30 // just in case. 31 Close(); 32 return IPC_OK(); 33 } 34 35 } // namespace mozilla::dom