| 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/child_process_launcher_android.h" | 5 #include "content/browser/android/child_process_launcher_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 // Pass a java surface object to the MediaPlayerAndroid object | 32 // Pass a java surface object to the MediaPlayerAndroid object |
| 33 // identified by render process handle, render frame ID and player ID. | 33 // identified by render process handle, render frame ID and player ID. |
| 34 static void SetSurfacePeer( | 34 static void SetSurfacePeer( |
| 35 const base::android::JavaRef<jobject>& surface, | 35 const base::android::JavaRef<jobject>& surface, |
| 36 base::ProcessHandle render_process_handle, | 36 base::ProcessHandle render_process_handle, |
| 37 int render_frame_id, | 37 int render_frame_id, |
| 38 int player_id) { | 38 int player_id) { |
| 39 #if !defined(USE_AURA) |
| 39 int render_process_id = 0; | 40 int render_process_id = 0; |
| 40 RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); | 41 RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); |
| 41 while (!it.IsAtEnd()) { | 42 while (!it.IsAtEnd()) { |
| 42 if (it.GetCurrentValue()->GetHandle() == render_process_handle) { | 43 if (it.GetCurrentValue()->GetHandle() == render_process_handle) { |
| 43 render_process_id = it.GetCurrentValue()->GetID(); | 44 render_process_id = it.GetCurrentValue()->GetID(); |
| 44 break; | 45 break; |
| 45 } | 46 } |
| 46 it.Advance(); | 47 it.Advance(); |
| 47 } | 48 } |
| 48 if (!render_process_id) { | 49 if (!render_process_id) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 70 media::MediaPlayerAndroid* player = player_manager->GetPlayer(player_id); | 71 media::MediaPlayerAndroid* player = player_manager->GetPlayer(player_id); |
| 71 if (!player) { | 72 if (!player) { |
| 72 DVLOG(1) << "Cannot find media player for player_id " << player_id; | 73 DVLOG(1) << "Cannot find media player for player_id " << player_id; |
| 73 return; | 74 return; |
| 74 } | 75 } |
| 75 | 76 |
| 76 if (player != player_manager->GetFullscreenPlayer()) { | 77 if (player != player_manager->GetFullscreenPlayer()) { |
| 77 gfx::ScopedJavaSurface scoped_surface(surface); | 78 gfx::ScopedJavaSurface scoped_surface(surface); |
| 78 player->SetVideoSurface(scoped_surface.Pass()); | 79 player->SetVideoSurface(scoped_surface.Pass()); |
| 79 } | 80 } |
| 81 #else |
| 82 NOTREACHED(); |
| 83 #endif |
| 80 } | 84 } |
| 81 | 85 |
| 82 } // anonymous namespace | 86 } // anonymous namespace |
| 83 | 87 |
| 84 // Called from ChildProcessLauncher.java when the ChildProcess was | 88 // Called from ChildProcessLauncher.java when the ChildProcess was |
| 85 // started. | 89 // started. |
| 86 // |client_context| is the pointer to StartChildProcessCallback which was | 90 // |client_context| is the pointer to StartChildProcessCallback which was |
| 87 // passed in from StartChildProcess. | 91 // passed in from StartChildProcess. |
| 88 // |handle| is the processID of the child process as originated in Java, 0 if | 92 // |handle| is the processID of the child process as originated in Java, 0 if |
| 89 // the ChildProcess could not be created. | 93 // the ChildProcess could not be created. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 jboolean IsSingleProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) { | 231 jboolean IsSingleProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) { |
| 228 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 232 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 229 switches::kSingleProcess); | 233 switches::kSingleProcess); |
| 230 } | 234 } |
| 231 | 235 |
| 232 bool RegisterChildProcessLauncher(JNIEnv* env) { | 236 bool RegisterChildProcessLauncher(JNIEnv* env) { |
| 233 return RegisterNativesImpl(env); | 237 return RegisterNativesImpl(env); |
| 234 } | 238 } |
| 235 | 239 |
| 236 } // namespace content | 240 } // namespace content |
| OLD | NEW |