| // 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/util/cpp/incident.h" |
| // 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) { |
| ThreadsafeIncident::ThreadsafeIncident() {} |
| ThreadsafeIncident::~ThreadsafeIncident() {} |
| void ThreadsafeIncident::Occur() { |
| std::vector<std::function<void()>> consequences; |
| base::AutoLock lock(consequences_lock_); |
| consequences_.swap(consequences); |
| for (const std::function<void()>& consequence : consequences) { |