Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/android/content_video_view.h" | 5 #include "content/browser/android/content_video_view.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 base::MessageLoop::current()->PostTask( | 188 base::MessageLoop::current()->PostTask( |
| 189 FROM_HERE, | 189 FROM_HERE, |
| 190 base::Bind(&ContentVideoView::UpdateMediaMetadata, | 190 base::Bind(&ContentVideoView::UpdateMediaMetadata, |
| 191 weak_factory_.GetWeakPtr())); | 191 weak_factory_.GetWeakPtr())); |
| 192 } | 192 } |
| 193 | 193 |
| 194 ScopedJavaLocalRef<jobject> ContentVideoView::GetJavaObject(JNIEnv* env) { | 194 ScopedJavaLocalRef<jobject> ContentVideoView::GetJavaObject(JNIEnv* env) { |
| 195 return j_content_video_view_.get(env); | 195 return j_content_video_view_.get(env); |
| 196 } | 196 } |
| 197 | 197 |
| 198 JavaObjectWeakGlobalRef ContentVideoView::CreateJavaObject() { | 198 JavaObjectWeakGlobalRef ContentVideoView::CreateJavaObject() { |
|
Ted C
2015/04/08 15:59:36
do the callers of this properly null check?
boliu
2015/04/08 16:04:29
Yes. See content_video_view.is_null() throughout t
Ted C
2015/04/08 17:13:50
They are all pretty gross. I don't really have a
| |
| 199 ContentViewCore* content_view_core = manager_->GetContentViewCore(); | 199 ContentViewCore* content_view_core = manager_->GetContentViewCore(); |
| 200 JNIEnv* env = AttachCurrentThread(); | 200 JNIEnv* env = AttachCurrentThread(); |
| 201 | |
| 202 base::android::ScopedJavaLocalRef<jobject> j_content_view_core = | |
| 203 content_view_core->GetJavaObject(); | |
| 204 if (j_content_view_core.is_null()) | |
| 205 return JavaObjectWeakGlobalRef(env, nullptr); | |
| 206 | |
| 201 return JavaObjectWeakGlobalRef( | 207 return JavaObjectWeakGlobalRef( |
| 202 env, | 208 env, |
| 203 Java_ContentVideoView_createContentVideoView( | 209 Java_ContentVideoView_createContentVideoView( |
| 204 env, | 210 env, |
| 205 content_view_core->GetJavaObject().obj(), | 211 j_content_view_core.obj(), |
| 206 reinterpret_cast<intptr_t>(this)).obj()); | 212 reinterpret_cast<intptr_t>(this)).obj()); |
| 207 } | 213 } |
| 208 } // namespace content | 214 } // namespace content |
| OLD | NEW |