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 |
| 10 #include <memory> |
9 #include <utility> | 11 #include <utility> |
10 | 12 |
11 #include "base/android/context_utils.h" | 13 #include "base/android/context_utils.h" |
12 #include "base/android/jni_android.h" | 14 #include "base/android/jni_android.h" |
13 #include "base/android/jni_array.h" | 15 #include "base/android/jni_array.h" |
14 #include "base/logging.h" | 16 #include "base/logging.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "content/browser/file_descriptor_info_impl.h" | 17 #include "content/browser/file_descriptor_info_impl.h" |
17 #include "content/browser/frame_host/render_frame_host_impl.h" | 18 #include "content/browser/frame_host/render_frame_host_impl.h" |
18 #include "content/browser/media/android/browser_media_player_manager.h" | 19 #include "content/browser/media/android/browser_media_player_manager.h" |
19 #include "content/browser/media/android/media_web_contents_observer_android.h" | 20 #include "content/browser/media/android/media_web_contents_observer_android.h" |
20 #include "content/browser/web_contents/web_contents_impl.h" | 21 #include "content/browser/web_contents/web_contents_impl.h" |
21 #include "content/common/child_process_host_impl.h" | 22 #include "content/common/child_process_host_impl.h" |
22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
23 #include "content/public/browser/content_browser_client.h" | 24 #include "content/public/browser/content_browser_client.h" |
24 #include "content/public/browser/render_process_host.h" | 25 #include "content/public/browser/render_process_host.h" |
25 #include "content/public/common/content_client.h" | 26 #include "content/public/common/content_client.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 return; | 83 return; |
83 } | 84 } |
84 | 85 |
85 if (player != player_manager->GetFullscreenPlayer()) { | 86 if (player != player_manager->GetFullscreenPlayer()) { |
86 gfx::ScopedJavaSurface scoped_surface(surface); | 87 gfx::ScopedJavaSurface scoped_surface(surface); |
87 player->SetVideoSurface(std::move(scoped_surface)); | 88 player->SetVideoSurface(std::move(scoped_surface)); |
88 } | 89 } |
89 } | 90 } |
90 | 91 |
91 void LaunchDownloadProcess(base::CommandLine* cmd_line) { | 92 void LaunchDownloadProcess(base::CommandLine* cmd_line) { |
92 scoped_ptr<base::CommandLine> cmd_line_deleter(cmd_line); | 93 std::unique_ptr<base::CommandLine> cmd_line_deleter(cmd_line); |
93 | 94 |
94 JNIEnv* env = AttachCurrentThread(); | 95 JNIEnv* env = AttachCurrentThread(); |
95 DCHECK(env); | 96 DCHECK(env); |
96 | 97 |
97 // Create the Command line String[] | 98 // Create the Command line String[] |
98 ScopedJavaLocalRef<jobjectArray> j_argv = | 99 ScopedJavaLocalRef<jobjectArray> j_argv = |
99 ToJavaArrayOfStrings(env, cmd_line->argv()); | 100 ToJavaArrayOfStrings(env, cmd_line->argv()); |
100 | 101 |
101 // TODO(qinmin): pass download parameters here. | 102 // TODO(qinmin): pass download parameters here. |
102 Java_ChildProcessLauncher_startDownloadProcessIfNecessary( | 103 Java_ChildProcessLauncher_startDownloadProcessIfNecessary( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches, | 145 cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches, |
145 arraysize(kForwardSwitches)); | 146 arraysize(kForwardSwitches)); |
146 CHECK(!cmd_line->HasSwitch(switches::kSingleProcess)); | 147 CHECK(!cmd_line->HasSwitch(switches::kSingleProcess)); |
147 BrowserThread::PostTask(BrowserThread::PROCESS_LAUNCHER, FROM_HERE, | 148 BrowserThread::PostTask(BrowserThread::PROCESS_LAUNCHER, FROM_HERE, |
148 base::Bind(&LaunchDownloadProcess, cmd_line)); | 149 base::Bind(&LaunchDownloadProcess, cmd_line)); |
149 } | 150 } |
150 | 151 |
151 void StartChildProcess( | 152 void StartChildProcess( |
152 const base::CommandLine::StringVector& argv, | 153 const base::CommandLine::StringVector& argv, |
153 int child_process_id, | 154 int child_process_id, |
154 scoped_ptr<content::FileDescriptorInfo> files_to_register, | 155 std::unique_ptr<content::FileDescriptorInfo> files_to_register, |
155 const std::map<int, base::MemoryMappedFile::Region>& regions, | 156 const std::map<int, base::MemoryMappedFile::Region>& regions, |
156 const StartChildProcessCallback& callback) { | 157 const StartChildProcessCallback& callback) { |
157 JNIEnv* env = AttachCurrentThread(); | 158 JNIEnv* env = AttachCurrentThread(); |
158 DCHECK(env); | 159 DCHECK(env); |
159 | 160 |
160 // Create the Command line String[] | 161 // Create the Command line String[] |
161 ScopedJavaLocalRef<jobjectArray> j_argv = ToJavaArrayOfStrings(env, argv); | 162 ScopedJavaLocalRef<jobjectArray> j_argv = ToJavaArrayOfStrings(env, argv); |
162 | 163 |
163 size_t file_count = files_to_register->GetMappingSize(); | 164 size_t file_count = files_to_register->GetMappingSize(); |
164 DCHECK(file_count > 0); | 165 DCHECK(file_count > 0); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 jboolean IsSingleProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) { | 278 jboolean IsSingleProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) { |
278 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 279 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
279 switches::kSingleProcess); | 280 switches::kSingleProcess); |
280 } | 281 } |
281 | 282 |
282 bool RegisterChildProcessLauncher(JNIEnv* env) { | 283 bool RegisterChildProcessLauncher(JNIEnv* env) { |
283 return RegisterNativesImpl(env); | 284 return RegisterNativesImpl(env); |
284 } | 285 } |
285 | 286 |
286 } // namespace content | 287 } // namespace content |
OLD | NEW |