OggCodecStore.cpp (948B)
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 "OggCodecStore.h" 8 9 namespace mozilla { 10 11 OggCodecStore::OggCodecStore() : mMonitor("CodecStore") {} 12 13 OggCodecState* OggCodecStore::Add(uint32_t serial, 14 UniquePtr<OggCodecState> codecState) { 15 MonitorAutoLock mon(mMonitor); 16 return mCodecStates.InsertOrUpdate(serial, std::move(codecState)).get(); 17 } 18 19 bool OggCodecStore::Contains(uint32_t serial) { 20 MonitorAutoLock mon(mMonitor); 21 return mCodecStates.Get(serial, nullptr); 22 } 23 24 OggCodecState* OggCodecStore::Get(uint32_t serial) { 25 MonitorAutoLock mon(mMonitor); 26 return mCodecStates.Get(serial); 27 } 28 29 } // namespace mozilla