blob: 1d71acded10fa08b7143797ac34f9dbfeeb72e06 [file]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "services/media/framework/incident.h"
namespace mojo {
namespace media {
Incident::Incident() {}
Incident::~Incident() {}
void Incident::Occur() {
if (occurred_) {
return;
}
occurred_ = true;
// Swap out consequences_ in case one of the callbacks deletes this.
std::vector<std::function<void()>> consequences;
consequences_.swap(consequences);
for (const std::function<void()>& consequence : consequences) {
consequence();
}
}
} // namespace media
} // namespace mojo