Chromium Code Reviews| 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..67a07af2eec6cf5bc3467bb1285a216534d64a76 |
| --- /dev/null |
| +++ b/content/browser/media/android/media_throttler.cc |
| @@ -0,0 +1,47 @@ |
| +// 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 |
|
Ted C
2015/09/28 22:42:29
I would add a blank line above this.
qinmin
2015/09/29 23:16:23
Done.
|
| +MediaThrottler* MediaThrottler::GetInstance() { |
| + return base::Singleton<MediaThrottler>::get(); |
| +} |
| + |
| +// static |
| +bool MediaThrottler::RegisterMediaThrottler(JNIEnv* env) { |
| + return RegisterNativesImpl(env); |
| +} |
| + |
| +MediaThrottler::MediaThrottler() { |
|
Ted C
2015/09/28 22:42:29
this should go at the bottom to match the header o
qinmin
2015/09/29 23:16:22
Done.
|
| + JNIEnv* env = base::android::AttachCurrentThread(); |
| + CHECK(env); |
| + |
| + j_media_throttler_.Reset(Java_MediaThrottler_create( |
| + env, base::android::GetApplicationContext())); |
| +} |
| + |
| +MediaThrottler::~MediaThrottler() {} |
| + |
| +bool MediaThrottler::RequestToDecodeData() { |
| + JNIEnv* env = base::android::AttachCurrentThread(); |
| + return Java_MediaThrottler_requestToDecodeData( |
| + 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()); |
| +} |
| + |
| +} // namespace content |