Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(763)

Unified Diff: content/browser/media/android/media_throttler.h

Issue 1372203002: Throttle media decoding after excessive Android media server crashes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: new infobar text per UI review Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..002dcd77568a0cf51d32cfd100be642d07712f31
--- /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 RequestDecoderResources();
+
+ // 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_
« no previous file with comments | « content/browser/media/android/browser_media_player_manager.cc ('k') | content/browser/media/android/media_throttler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698