Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_VOICE_ENGINE_MONITOR_MODULE_H | 11 #ifndef WEBRTC_VOICE_ENGINE_MONITOR_MODULE_H |
| 12 #define WEBRTC_VOICE_ENGINE_MONITOR_MODULE_H | 12 #define WEBRTC_VOICE_ENGINE_MONITOR_MODULE_H |
| 13 | 13 |
| 14 #include "webrtc/base/criticalsection.h" | |
| 14 #include "webrtc/modules/include/module.h" | 15 #include "webrtc/modules/include/module.h" |
| 15 #include "webrtc/typedefs.h" | 16 #include "webrtc/typedefs.h" |
| 16 #include "webrtc/voice_engine/voice_engine_defines.h" | 17 #include "webrtc/voice_engine/voice_engine_defines.h" |
| 17 | 18 |
| 18 class MonitorObserver | 19 class MonitorObserver |
| 19 { | 20 { |
| 20 public: | 21 public: |
| 21 virtual void OnPeriodicProcess() = 0; | 22 virtual void OnPeriodicProcess() = 0; |
| 22 protected: | 23 protected: |
| 23 virtual ~MonitorObserver() {} | 24 virtual ~MonitorObserver() {} |
| 24 }; | 25 }; |
| 25 | 26 |
| 26 | 27 |
| 27 namespace webrtc { | 28 namespace webrtc { |
| 28 class CriticalSectionWrapper; | |
| 29 | |
| 30 namespace voe { | 29 namespace voe { |
| 31 | 30 |
| 32 class MonitorModule : public Module | 31 class MonitorModule : public Module |
| 33 { | 32 { |
| 34 public: | 33 public: |
| 35 int32_t RegisterObserver(MonitorObserver& observer); | 34 int32_t RegisterObserver(MonitorObserver& observer); |
| 36 | 35 |
| 37 int32_t DeRegisterObserver(); | 36 int32_t DeRegisterObserver(); |
| 38 | 37 |
| 39 MonitorModule(); | 38 MonitorModule(); |
| 40 | 39 |
| 41 virtual ~MonitorModule(); | 40 virtual ~MonitorModule(); |
| 42 public: // module | 41 public: // module |
| 43 int64_t TimeUntilNextProcess() override; | 42 int64_t TimeUntilNextProcess() override; |
| 44 | 43 |
| 45 int32_t Process() override; | 44 int32_t Process() override; |
| 46 | 45 |
| 47 private: | 46 private: |
| 48 MonitorObserver* _observerPtr; | 47 MonitorObserver* _observerPtr; |
| 49 CriticalSectionWrapper&» _callbackCritSect; | 48 mutable rtc::CriticalSection _callbackCritSect; |
|
the sun
2016/01/21 13:07:28
nits: remove mutable, add GUARDED_BY to _observerP
tommi
2016/01/21 15:29:23
Done.
tommi
2016/01/21 15:37:15
Oh and that nit uncovered a bug in the code! Nice.
the sun
2016/01/21 19:28:45
How about that! :)
| |
| 50 int64_t _lastProcessTime; | 49 int64_t _lastProcessTime; |
| 51 }; | 50 }; |
| 52 | 51 |
| 53 } // namespace voe | 52 } // namespace voe |
| 54 | 53 |
| 55 } // namespace webrtc | 54 } // namespace webrtc |
| 56 | 55 |
| 57 #endif // VOICE_ENGINE_MONITOR_MODULE | 56 #endif // VOICE_ENGINE_MONITOR_MODULE |
| OLD | NEW |