| 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/app/android/child_process_service.h" | 5 #include "content/app/android/child_process_service.h" |
| 6 | 6 |
| 7 #include <android/native_window_jni.h> | 7 #include <android/native_window_jni.h> |
| 8 #include <cpu-features.h> | 8 #include <cpu-features.h> |
| 9 | 9 |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // Note: This ensures that any local references used by | 116 // Note: This ensures that any local references used by |
| 117 // ANativeWindow_fromSurface are released immediately. This is needed as a | 117 // ANativeWindow_fromSurface are released immediately. This is needed as a |
| 118 // workaround for https://code.google.com/p/android/issues/detail?id=68174 | 118 // workaround for https://code.google.com/p/android/issues/detail?id=68174 |
| 119 base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env); | 119 base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env); |
| 120 ANativeWindow* native_window = | 120 ANativeWindow* native_window = |
| 121 ANativeWindow_fromSurface(env, surface.j_surface().obj()); | 121 ANativeWindow_fromSurface(env, surface.j_surface().obj()); |
| 122 | 122 |
| 123 return native_window; | 123 return native_window; |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Overridden from GpuSurfaceLookup: |
| 127 gfx::ScopedJavaSurface AcquireJavaSurface(int surface_id) override { |
| 128 JNIEnv* env = base::android::AttachCurrentThread(); |
| 129 return gfx::ScopedJavaSurface( |
| 130 content::Java_ChildProcessService_getViewSurface(env, service_.obj(), |
| 131 surface_id)); |
| 132 } |
| 133 |
| 126 private: | 134 private: |
| 127 // The instance of org.chromium.content.app.ChildProcessService. | 135 // The instance of org.chromium.content.app.ChildProcessService. |
| 128 base::android::ScopedJavaGlobalRef<jobject> service_; | 136 base::android::ScopedJavaGlobalRef<jobject> service_; |
| 129 | 137 |
| 130 DISALLOW_COPY_AND_ASSIGN(SurfaceTextureManagerImpl); | 138 DISALLOW_COPY_AND_ASSIGN(SurfaceTextureManagerImpl); |
| 131 }; | 139 }; |
| 132 | 140 |
| 133 // Chrome actually uses the renderer code path for all of its child | 141 // Chrome actually uses the renderer code path for all of its child |
| 134 // processes such as renderers, plugins, etc. | 142 // processes such as renderers, plugins, etc. |
| 135 void InternalInitChildProcess(JNIEnv* env, | 143 void InternalInitChildProcess(JNIEnv* env, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 179 |
| 172 bool RegisterChildProcessService(JNIEnv* env) { | 180 bool RegisterChildProcessService(JNIEnv* env) { |
| 173 return RegisterNativesImpl(env); | 181 return RegisterNativesImpl(env); |
| 174 } | 182 } |
| 175 | 183 |
| 176 void ShutdownMainThread(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 184 void ShutdownMainThread(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 177 ChildThreadImpl::ShutdownThread(); | 185 ChildThreadImpl::ShutdownThread(); |
| 178 } | 186 } |
| 179 | 187 |
| 180 } // namespace content | 188 } // namespace content |
| OLD | NEW |