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

Side by Side Diff: pkg/analyzer/lib/instrumentation/instrumentation.dart

Issue 837753002: Tweak for escaping in instrumentation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analyzer/test/instrumentation/instrumentation_test.dart » ('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 (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library instrumentation; 5 library instrumentation;
6 6
7 /** 7 /**
8 * The interface used by client code to communicate with an instrumentation 8 * The interface used by client code to communicate with an instrumentation
9 * server. 9 * server.
10 */ 10 */
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 * should be invoked on this instance after this method has been invoked. 128 * should be invoked on this instance after this method has been invoked.
129 */ 129 */
130 void shutdown() { 130 void shutdown() {
131 if (_instrumentationServer != null) { 131 if (_instrumentationServer != null) {
132 _instrumentationServer.shutdown(); 132 _instrumentationServer.shutdown();
133 _instrumentationServer = null; 133 _instrumentationServer = null;
134 } 134 }
135 } 135 }
136 136
137 /** 137 /**
138 * Write an escaped version of the given [string] to the given [buffer]. 138 * Write an escaped version of the given [field] to the given [buffer].
139 */ 139 */
140 void _escape(StringBuffer buffer, String field) { 140 void _escape(StringBuffer buffer, String field) {
141 int index = field.indexOf(':'); 141 int index = field.indexOf(':');
142 if (index < 0) { 142 if (index < 0) {
143 buffer.write(field); 143 buffer.write(field);
144 return; 144 return;
145 } 145 }
146 int start = 0; 146 int start = 0;
147 while (index > 0) { 147 while (index >= 0) {
148 buffer.write(field.substring(start, index)); 148 buffer.write(field.substring(start, index));
149 buffer.write('::'); 149 buffer.write('::');
150 start = index + 1; 150 start = index + 1;
151 index = field.indexOf(':', start); 151 index = field.indexOf(':', start);
152 } 152 }
153 buffer.write(field.substring(start)); 153 buffer.write(field.substring(start));
154 } 154 }
155 155
156 /** 156 /**
157 * Return the result of joining the values of the given fields, escaping the 157 * Return the result of joining the values of the given fields, escaping the
(...skipping 21 matching lines...) Expand all
179 /** 179 /**
180 * Convert the given [object] to a string. 180 * Convert the given [object] to a string.
181 */ 181 */
182 String _toString(Object object) { 182 String _toString(Object object) {
183 if (object == null) { 183 if (object == null) {
184 return 'null'; 184 return 'null';
185 } 185 }
186 return object.toString(); 186 return object.toString();
187 } 187 }
188 } 188 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/instrumentation/instrumentation_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698