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

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: lru unit tests Created 5 years, 6 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
« media/blink/multibuffer.cc ('K') | « media/blink/rangemap_unittests.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..83f44344c3a22ecf34dc7c6a56c1326b885c5aeb
--- /dev/null
+++ b/media/blink/waiter_index.h
@@ -0,0 +1,44 @@
+// Copyright 2013 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.
+
+#ifndef MEDIA_BLINK_WAITER_INDEX_H_
+#define MEDIA_BLINK_WAITER_INDEX_H_
+
+#include <map>
+#include <set>
+
+namespace media {
+
+class Waiter {
+public:
+ virtual ~Waiter() {}
+ virtual void Continue() = 0;
+};
+
+class WaiterIndex {
+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);
+ // Delete all waiters. Makes it possible for
+ // for this class to own waiters.
+ void DeleteWaiters();
+
+ 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
« media/blink/multibuffer.cc ('K') | « media/blink/rangemap_unittests.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698