Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: mojo/tools/mopy/android.py

Issue 1151363004: Mojo: Send Android args in a string array, not JSON. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/runner/android/apk/src/org/chromium/mojo/shell/MojoShellActivity.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 import atexit 5 import atexit
6 import itertools 6 import itertools
7 import json
8 import logging 7 import logging
9 import os 8 import os
10 import shutil 9 import shutil
11 import signal 10 import signal
12 import subprocess 11 import subprocess
13 import sys 12 import sys
14 import tempfile 13 import tempfile
15 import threading 14 import threading
16 import time 15 import time
17 import urlparse 16 import urlparse
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 arguments += ['--wait-for-debugger'] 248 arguments += ['--wait-for-debugger']
250 logcat_process = self.ShowLogs(stdout=subprocess.PIPE) 249 logcat_process = self.ShowLogs(stdout=subprocess.PIPE)
251 250
252 fifo_path = "/data/data/%s/stdout.fifo" % self.target_package 251 fifo_path = "/data/data/%s/stdout.fifo" % self.target_package
253 subprocess.check_call(self._CreateADBCommand( 252 subprocess.check_call(self._CreateADBCommand(
254 ['shell', 'rm', '-f', fifo_path])) 253 ['shell', 'rm', '-f', fifo_path]))
255 arguments.append('--fifo-path=%s' % fifo_path) 254 arguments.append('--fifo-path=%s' % fifo_path)
256 max_attempts = 200 if '--wait-for-debugger' in arguments else 5 255 max_attempts = 200 if '--wait-for-debugger' in arguments else 5
257 self._ReadFifo(fifo_path, stdout, on_application_stop, max_attempts) 256 self._ReadFifo(fifo_path, stdout, on_application_stop, max_attempts)
258 257
259 # Extract map-origin arguments. 258 # Extract map-origin args and add the extras array with commas escaped.
260 parameters = [a for a in arguments if not a.startswith(MAPPING_PREFIX)] 259 parameters = [a for a in arguments if not a.startswith(MAPPING_PREFIX)]
261 map_parameters = [a for a in arguments if a.startswith(MAPPING_PREFIX)] 260 map_parameters = [a for a in arguments if a.startswith(MAPPING_PREFIX)]
262 parameters += self._StartHttpServerForOriginMappings(map_parameters) 261 parameters += self._StartHttpServerForOriginMappings(map_parameters)
263 262 parameters = [p.replace(',', '\,') for p in parameters]
264 if parameters: 263 if parameters:
265 cmd += ['--es', 'encodedParameters', json.dumps(parameters)] 264 cmd += ['--esa', 'org.chromium.mojo.shell.extras', ','.join(parameters)]
266 265
267 atexit.register(self.StopShell) 266 atexit.register(self.StopShell)
268 with open(os.devnull, 'w') as devnull: 267 with open(os.devnull, 'w') as devnull:
269 cmd_process = subprocess.Popen(cmd, stdout=devnull) 268 cmd_process = subprocess.Popen(cmd, stdout=devnull)
270 if logcat_process: 269 if logcat_process:
271 self._WaitForProcessIdAndStartGdb(logcat_process) 270 self._WaitForProcessIdAndStartGdb(logcat_process)
272 cmd_process.wait() 271 cmd_process.wait()
273 272
274 def StopShell(self): 273 def StopShell(self):
275 """Stops the mojo shell.""" 274 """Stops the mojo shell."""
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 files_to_link = { 330 files_to_link = {
332 'html_viewer.mojo': ['libhtml_viewer', 'html_viewer_library.so'], 331 'html_viewer.mojo': ['libhtml_viewer', 'html_viewer_library.so'],
333 'libmandoline_runner.so': ['mandoline_runner'], 332 'libmandoline_runner.so': ['mandoline_runner'],
334 } 333 }
335 for android_name, so_path in files_to_link.iteritems(): 334 for android_name, so_path in files_to_link.iteritems():
336 src = os.path.join(build_dir, *so_path) 335 src = os.path.join(build_dir, *so_path)
337 if not os.path.isfile(src): 336 if not os.path.isfile(src):
338 print 'Expected file not found', src 337 print 'Expected file not found', src
339 sys.exit(-1) 338 sys.exit(-1)
340 os.symlink(src, os.path.join(dest_dir, android_name)) 339 os.symlink(src, os.path.join(dest_dir, android_name))
OLDNEW
« no previous file with comments | « mojo/runner/android/apk/src/org/chromium/mojo/shell/MojoShellActivity.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698