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

Unified Diff: media/blink/waiter_index.h

Issue 1165903002: Multi reader/writer cache/buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more tests Created 5 years, 2 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: media/blink/waiter_index.h
diff --git a/media/blink/waiter_index.h b/media/blink/waiter_index.h
new file mode 100644
index 0000000000000000000000000000000000000000..0f79b80e84442c7be2fdc19fc28f274bb054493a
--- /dev/null
+++ b/media/blink/waiter_index.h
@@ -0,0 +1,46 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
liberato (no reviews please) 2015/10/09 17:36:10 2015
hubbe 2015/10/13 23:08:17 Gone.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_BLINK_WAITER_INDEX_H_
+#define MEDIA_BLINK_WAITER_INDEX_H_
+
+#include <map>
+#include <set>
+
+#include "base/macros.h"
+
+namespace media {
+
+class Waiter {
+public:
+ Waiter() {}
+ virtual ~Waiter() {}
+ virtual void Continue() = 0;
+private:
+ DISALLOW_COPY_AND_ASSIGN(Waiter);
+};
+
+class WaiterIndex {
liberato (no reviews please) 2015/10/09 17:36:10 why is WaiterIndex included in this CL?
hubbe 2015/10/13 23:08:17 Gone.
+public:
+ WaiterIndex();
+ ~WaiterIndex();
+ // Register a waiter at position |pos|.
+ void WaitFor(int32_t pos, Waiter* waiter);
+ // Unregister a waiter, |pos| should be the same
+ // position as given to WaitFor().
+ void StopWaitFor(int32_t pos, Waiter* waiter);
+ // Wake up all waiters waiting at |pos|.
+ void WakeUp(int32_t pos);
+
+ const std::map<int32_t, std::set<Waiter*> >& map() const {
+ return waiters_;
+ }
+
+ private:
+ std::map<int32_t, std::set<Waiter*> > waiters_;
+};
+
+} // namespace media
+
+#endif // MEDIA_BLINK_WAITER_INDEX_H

Powered by Google App Engine
This is Rietveld 408576698