Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1530)

Unified Diff: services/media/framework/util/incident.cc

Issue 2024953003: Motown: Move framework/util/incident* so other services can use it (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: services/media/framework/util/incident.cc
diff --git a/services/media/framework/util/incident.cc b/services/media/framework/util/incident.cc
deleted file mode 100644
index 3b6a1e3602f2306f8097c7da06fcd9290bcdabe6..0000000000000000000000000000000000000000
--- a/services/media/framework/util/incident.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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/util/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();
- }
-}
-
-ThreadsafeIncident::ThreadsafeIncident() {}
-
-ThreadsafeIncident::~ThreadsafeIncident() {}
-
-void ThreadsafeIncident::Occur() {
- std::vector<std::function<void()>> consequences;
-
- {
- base::AutoLock lock(consequences_lock_);
-
- if (occurred_) {
- return;
- }
-
- occurred_ = true;
- consequences_.swap(consequences);
- }
-
- for (const std::function<void()>& consequence : consequences) {
- consequence();
- }
-}
-
-} // namespace media
-} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698