| 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/macros.h" | |
| 12 #include "base/memory/singleton.h" | |
| 13 | |
| 14 namespace content { | |
| 15 | |
| 16 class MediaThrottler { | |
| 17 public: | |
| 18 // Called to get the singleton MediaThrottler instance. | |
| 19 static MediaThrottler* GetInstance(); | |
| 20 | |
| 21 virtual ~MediaThrottler(); | |
| 22 | |
| 23 // Called to request the permission to decode media data. Returns true if | |
| 24 // permitted, or false otherwise. | |
| 25 bool RequestDecoderResources(); | |
| 26 | |
| 27 // Called when a decode request finishes. | |
| 28 void OnDecodeRequestFinished(); | |
| 29 | |
| 30 // Resets the throttler to a fresh state. | |
| 31 void Reset(); | |
| 32 | |
| 33 private: | |
| 34 friend struct base::DefaultSingletonTraits<MediaThrottler>; | |
| 35 MediaThrottler(); | |
| 36 | |
| 37 base::android::ScopedJavaGlobalRef<jobject> j_media_throttler_; | |
| 38 DISALLOW_COPY_AND_ASSIGN(MediaThrottler); | |
| 39 }; | |
| 40 | |
| 41 } // namespace content | |
| 42 | |
| 43 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_THROTTLER_H_ | |
| OLD | NEW |