OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_CAST_LOGGING_SIMPLE_EVENT_SUBSCRIBER_H_ | 5 #ifndef MEDIA_CAST_LOGGING_SIMPLE_EVENT_SUBSCRIBER_H_ |
6 #define MEDIA_CAST_LOGGING_SIMPLE_EVENT_SUBSCRIBER_H_ | 6 #define MEDIA_CAST_LOGGING_SIMPLE_EVENT_SUBSCRIBER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
12 #include "media/cast/logging/raw_event_subscriber.h" | 12 #include "media/cast/logging/raw_event_subscriber.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 namespace cast { | 15 namespace cast { |
16 | 16 |
17 // RawEventSubscriber implementation that records all incoming raw events | 17 // RawEventSubscriber implementation that records all incoming raw events |
18 // in std::vector's. | 18 // in std::vector's. |
19 // The user of this class can call the GetXXXEventsAndReset functions to get | 19 // The user of this class can call the GetXXXEventsAndReset functions to get |
20 // list of events that have acccumulated since last inovcation. | 20 // list of events that have acccumulated since last inovcation. |
21 class SimpleEventSubscriber : public RawEventSubscriber { | 21 class SimpleEventSubscriber : public RawEventSubscriber { |
22 public: | 22 public: |
23 SimpleEventSubscriber(); | 23 SimpleEventSubscriber(); |
24 | 24 |
25 virtual ~SimpleEventSubscriber(); | 25 virtual ~SimpleEventSubscriber(); |
26 | 26 |
27 // RawEventSubscriber implementations. | 27 // RawEventSubscriber implementations. |
28 virtual void OnReceiveFrameEvent(const FrameEvent& frame_event) OVERRIDE; | 28 virtual void OnReceiveFrameEvent(const FrameEvent& frame_event) override; |
29 virtual void OnReceivePacketEvent(const PacketEvent& packet_event) OVERRIDE; | 29 virtual void OnReceivePacketEvent(const PacketEvent& packet_event) override; |
30 | 30 |
31 // Assigns frame events received so far to |frame_events| and clears them | 31 // Assigns frame events received so far to |frame_events| and clears them |
32 // from this object. | 32 // from this object. |
33 void GetFrameEventsAndReset(std::vector<FrameEvent>* frame_events); | 33 void GetFrameEventsAndReset(std::vector<FrameEvent>* frame_events); |
34 | 34 |
35 // Assigns packet events received so far to |packet_events| and clears them | 35 // Assigns packet events received so far to |packet_events| and clears them |
36 // from this object. | 36 // from this object. |
37 void GetPacketEventsAndReset(std::vector<PacketEvent>* packet_events); | 37 void GetPacketEventsAndReset(std::vector<PacketEvent>* packet_events); |
38 | 38 |
39 private: | 39 private: |
40 std::vector<FrameEvent> frame_events_; | 40 std::vector<FrameEvent> frame_events_; |
41 std::vector<PacketEvent> packet_events_; | 41 std::vector<PacketEvent> packet_events_; |
42 | 42 |
43 // All functions must be called on the main thread. | 43 // All functions must be called on the main thread. |
44 base::ThreadChecker thread_checker_; | 44 base::ThreadChecker thread_checker_; |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(SimpleEventSubscriber); | 46 DISALLOW_COPY_AND_ASSIGN(SimpleEventSubscriber); |
47 }; | 47 }; |
48 | 48 |
49 } // namespace cast | 49 } // namespace cast |
50 } // namespace media | 50 } // namespace media |
51 | 51 |
52 #endif // MEDIA_CAST_LOGGING_SIMPLE_EVENT_SUBSCRIBER_H_ | 52 #endif // MEDIA_CAST_LOGGING_SIMPLE_EVENT_SUBSCRIBER_H_ |
OLD | NEW |