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

Side by Side Diff: mojo/devtools/common/devtoolslib/shell_arguments.py

Issue 1159063004: Support running with mojo:debugger in devtools. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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/devtools/common/devtoolslib/shell.py ('k') | mojo/tools/android_mojo_shell.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 """Functions that configure the shell before it is run manipulating its argument 5 """Functions that configure the shell before it is run manipulating its argument
6 list.""" 6 list."""
7 7
8 import urlparse 8 import urlparse
9 9
10 _MAP_ORIGIN_PREFIX = '--map-origin=' 10 _MAP_ORIGIN_PREFIX = '--map-origin='
11 # When spinning up servers for local origins, we want to use predictable ports 11 # When spinning up servers for local origins, we want to use predictable ports
12 # so that caching works between subsequent runs with the same command line. 12 # so that caching works between subsequent runs with the same command line.
13 _MAP_ORIGIN_BASE_PORT = 31338 13 _MAP_ORIGIN_BASE_PORT = 31338
14 14
15 # Port on which the mojo:debugger http server will be available on the host
16 # machine.
17 _MOJO_DEBUGGER_PORT = 7777
18
15 19
16 def _IsMapOrigin(arg): 20 def _IsMapOrigin(arg):
17 """Returns whether |arg| is a --map-origin argument.""" 21 """Returns whether |arg| is a --map-origin argument."""
18 return arg.startswith(_MAP_ORIGIN_PREFIX) 22 return arg.startswith(_MAP_ORIGIN_PREFIX)
19 23
20 24
21 def _Split(l, pred): 25 def _Split(l, pred):
22 positive = [] 26 positive = []
23 negative = [] 27 negative = []
24 for v in l: 28 for v in l:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 Returns: 60 Returns:
57 The updated argument list. 61 The updated argument list.
58 """ 62 """
59 map_arguments, other_arguments = _Split(original_arguments, _IsMapOrigin) 63 map_arguments, other_arguments = _Split(original_arguments, _IsMapOrigin)
60 arguments = other_arguments 64 arguments = other_arguments
61 next_port = _MAP_ORIGIN_BASE_PORT 65 next_port = _MAP_ORIGIN_BASE_PORT
62 for mapping in sorted(map_arguments): 66 for mapping in sorted(map_arguments):
63 arguments.append(_RewriteMapOriginParameter(shell, mapping, next_port)) 67 arguments.append(_RewriteMapOriginParameter(shell, mapping, next_port))
64 next_port += 1 68 next_port += 1
65 return arguments 69 return arguments
70
71
72 def ConfigureDebugger(shell):
73 """Configures mojo:debugger to run and sets up port forwarding for its http
74 server if the shell is running on a device.
75
76 Returns:
77 Arguments that need to be appended to the shell argument list in order to
78 run with the debugger.
79 """
80 shell.ForwardHostPortToShell(_MOJO_DEBUGGER_PORT)
81 return ['--args-for=mojo:debugger %d' % _MOJO_DEBUGGER_PORT,
82 'mojo:debugger']
qsr 2015/06/03 10:38:19 If you plan to run mojo:debuffer, you can pass the
ppi 2015/06/03 10:43:13 Done.
OLDNEW
« no previous file with comments | « mojo/devtools/common/devtoolslib/shell.py ('k') | mojo/tools/android_mojo_shell.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698