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

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

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.cc
diff --git a/content/browser/media/android/media_throttler.cc b/content/browser/media/android/media_throttler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..04c8030ff5be2a6163b9a71e7f03f3ed5a9230ac
--- /dev/null
+++ b/content/browser/media/android/media_throttler.cc
@@ -0,0 +1,48 @@
+// 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.
+
+#include "content/browser/media/android/media_throttler.h"
+
+#include "base/android/jni_android.h"
+#include "jni/MediaThrottler_jni.h"
+
+namespace content {
+
+// static
+MediaThrottler* MediaThrottler::GetInstance() {
+ return base::Singleton<MediaThrottler>::get();
+}
+
+// static
+bool MediaThrottler::RegisterMediaThrottler(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+MediaThrottler::~MediaThrottler() {}
+
+bool MediaThrottler::RequestDecoderResources() {
+ JNIEnv* env = base::android::AttachCurrentThread();
+ return Java_MediaThrottler_requestDecoderResources(
+ env, j_media_throttler_.obj());
+}
+
+void MediaThrottler::OnDecodeRequestFinished() {
+ JNIEnv* env = base::android::AttachCurrentThread();
+ Java_MediaThrottler_onDecodeRequestFinished(env, j_media_throttler_.obj());
+}
+
+void MediaThrottler::Reset() {
+ JNIEnv* env = base::android::AttachCurrentThread();
+ Java_MediaThrottler_reset(env, j_media_throttler_.obj());
+}
+
+MediaThrottler::MediaThrottler() {
+ JNIEnv* env = base::android::AttachCurrentThread();
+ CHECK(env);
+
+ j_media_throttler_.Reset(Java_MediaThrottler_create(
+ env, base::android::GetApplicationContext()));
+}
+
+} // namespace content
« no previous file with comments | « content/browser/media/android/media_throttler.h ('k') | content/browser/renderer_host/render_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698