Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_THROTTLER_H_ | |
| 6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_THROTTLER_H_ | |
| 7 | |
| 8 #include <jni.h> | |
| 9 | |
| 10 #include "base/android/scoped_java_ref.h" | |
| 11 #include "base/memory/singleton.h" | |
| 12 | |
| 13 namespace content { | |
| 14 | |
| 15 class MediaThrottler { | |
| 16 public: | |
| 17 // Called to get the singleton MediaThrottler instance. | |
| 18 static MediaThrottler* GetInstance(); | |
| 19 | |
| 20 // Jni registration. | |
| 21 static bool RegisterMediaThrottler(JNIEnv* env); | |
| 22 | |
| 23 virtual ~MediaThrottler(); | |
| 24 | |
| 25 // Called to request the permission to decode media data. Returns true if | |
| 26 // permitted, or false otherwise. | |
| 27 bool RequestToDecodeData(); | |
|
Tima Vaisburd
2015/09/28 22:09:12
nit: the naming was a little bit confusing for me.
qinmin
2015/09/29 23:16:23
Done.
| |
| 28 | |
| 29 // Called when a decode request finishes. | |
| 30 void OnDecodeRequestFinished(); | |
| 31 | |
| 32 // Resets the throttler to a fresh state. | |
| 33 void Reset(); | |
| 34 | |
| 35 private: | |
| 36 friend struct base::DefaultSingletonTraits<MediaThrottler>; | |
| 37 MediaThrottler(); | |
| 38 | |
| 39 base::android::ScopedJavaGlobalRef<jobject> j_media_throttler_; | |
| 40 DISALLOW_COPY_AND_ASSIGN(MediaThrottler); | |
| 41 }; | |
| 42 | |
| 43 } // namespace content | |
| 44 | |
| 45 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_THROTTLER_H_ | |
| OLD | NEW |