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

Unified Diff: components/copresence/handlers/audio/audio_directive_list.h

Issue 764673003: Adding CopresenceState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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: components/copresence/handlers/audio/audio_directive_list.h
diff --git a/components/copresence/handlers/audio/audio_directive_list.h b/components/copresence/handlers/audio/audio_directive_list.h
index c0b170b60dae07eda85a785af9feabf9a7253368..ccea27260ab91a7bba93b9c1a4cfead4762340f6 100644
--- a/components/copresence/handlers/audio/audio_directive_list.h
+++ b/components/copresence/handlers/audio/audio_directive_list.h
@@ -14,6 +14,7 @@
#include "base/time/default_tick_clock.h"
#include "base/time/time.h"
#include "components/copresence/handlers/audio/tick_clock_ref_counted.h"
+#include "components/copresence/proto/data.pb.h"
namespace media {
class AudioBusRefCounted;
@@ -26,12 +27,17 @@ class TickClockRefCounted;
struct AudioDirective final {
// Default ctor, required by the priority queue.
AudioDirective();
- AudioDirective(const std::string& op_id, base::TimeTicks end_time);
+ AudioDirective(const std::string& op_id,
+ base::TimeTicks end_time,
+ const Directive& server_directive);
std::string op_id;
+
// We're currently using TimeTicks to track time. This may not work for cases
// where your machine suspends. See crbug.com/426136
base::TimeTicks end_time;
+
+ Directive server_directive;
};
// This class maintains a list of active audio directives. It fetches the audio
@@ -40,17 +46,19 @@ struct AudioDirective final {
// TODO(rkc): Once we implement more token technologies, move reusable code
// from here to a base class and inherit various XxxxDirectiveList
// classes from it.
-class AudioDirectiveList {
+class AudioDirectiveList final {
public:
explicit AudioDirectiveList(const scoped_refptr<TickClockRefCounted>& clock =
make_scoped_refptr(new TickClockRefCounted(new base::DefaultTickClock)));
~AudioDirectiveList();
- void AddDirective(const std::string& op_id, base::TimeDelta ttl);
+ void AddDirective(const std::string& op_id, const Directive& directive);
void RemoveDirective(const std::string& op_id);
scoped_ptr<AudioDirective> GetActiveDirective();
+ const std::vector<AudioDirective>& directives() const;
+
private:
// Comparator for comparing end_times on audio tokens.
class LatestFirstComparator {

Powered by Google App Engine
This is Rietveld 408576698