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