Chromium Code Reviews| Index: content/browser/media/android/media_throttler.h |
| diff --git a/content/browser/media/android/media_throttler.h b/content/browser/media/android/media_throttler.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6d17a07bd3e81e381f53d97da5a0f24d9e7e0afd |
| --- /dev/null |
| +++ b/content/browser/media/android/media_throttler.h |
| @@ -0,0 +1,45 @@ |
| +// Copyright 2015 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 CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_THROTTLER_H_ |
| +#define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_THROTTLER_H_ |
| + |
| +#include <jni.h> |
| + |
| +#include "base/android/scoped_java_ref.h" |
| +#include "base/memory/singleton.h" |
| + |
| +namespace content { |
| + |
| +class MediaThrottler { |
| + public: |
| + // Called to get the singleton MediaThrottler instance. |
| + static MediaThrottler* GetInstance(); |
| + |
| + // Jni registration. |
| + static bool RegisterMediaThrottler(JNIEnv* env); |
| + |
| + virtual ~MediaThrottler(); |
| + |
| + // Called to request the permission to decode media data. Returns true if |
| + // permitted, or false otherwise. |
| + 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.
|
| + |
| + // Called when a decode request finishes. |
| + void OnDecodeRequestFinished(); |
| + |
| + // Resets the throttler to a fresh state. |
| + void Reset(); |
| + |
| + private: |
| + friend struct base::DefaultSingletonTraits<MediaThrottler>; |
| + MediaThrottler(); |
| + |
| + base::android::ScopedJavaGlobalRef<jobject> j_media_throttler_; |
| + DISALLOW_COPY_AND_ASSIGN(MediaThrottler); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_THROTTLER_H_ |