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

Side by Side Diff: runtime/bin/dbg_message.cc

Issue 23439002: JSON string decoding for VM debugger (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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 | runtime/platform/json.h » ('j') | runtime/platform/json.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #include "bin/dbg_connection.h" 5 #include "bin/dbg_connection.h"
6 #include "bin/dbg_message.h" 6 #include "bin/dbg_message.h"
7 #include "bin/dartutils.h" 7 #include "bin/dartutils.h"
8 #include "bin/thread.h" 8 #include "bin/thread.h"
9 #include "bin/utils.h" 9 #include "bin/utils.h"
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 char* MessageParser::GetStringParam(const char* name) const { 104 char* MessageParser::GetStringParam(const char* name) const {
105 const char* params = Params(); 105 const char* params = Params();
106 ASSERT(params != NULL); 106 ASSERT(params != NULL);
107 dart::JSONReader pr(params); 107 dart::JSONReader pr(params);
108 pr.Seek(name); 108 pr.Seek(name);
109 if (pr.Type() != dart::JSONReader::kString) { 109 if (pr.Type() != dart::JSONReader::kString) {
110 return NULL; 110 return NULL;
111 } 111 }
112 intptr_t buflen = pr.ValueLen() + 1; 112 intptr_t buflen = pr.ValueLen() + 1;
113 char* param_chars = reinterpret_cast<char*>(malloc(buflen)); 113 char* param_chars = reinterpret_cast<char*>(malloc(buflen));
114 pr.GetValueChars(param_chars, buflen); 114 pr.GetDecodedValueChars(param_chars, buflen);
115 // TODO(hausner): Decode escape sequences.
116 return param_chars; 115 return param_chars;
117 } 116 }
118 117
119 118
120 static void FormatEncodedCharsTrunc(dart::TextBuffer* buf, 119 static void FormatEncodedCharsTrunc(dart::TextBuffer* buf,
121 Dart_Handle str, 120 Dart_Handle str,
122 intptr_t max_chars) { 121 intptr_t max_chars) {
123 intptr_t str_len = 0; 122 intptr_t str_len = 0;
124 Dart_Handle res = Dart_StringLength(str, &str_len); 123 Dart_Handle res = Dart_StringLength(str, &str_len);
125 ASSERT_NOT_ERROR(res); 124 ASSERT_NOT_ERROR(res);
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 } else { 1301 } else {
1303 ASSERT(kind == kShutdown); 1302 ASSERT(kind == kShutdown);
1304 RemoveIsolateMsgQueue(isolate_id); 1303 RemoveIsolateMsgQueue(isolate_id);
1305 } 1304 }
1306 } 1305 }
1307 Dart_ExitScope(); 1306 Dart_ExitScope();
1308 } 1307 }
1309 1308
1310 } // namespace bin 1309 } // namespace bin
1311 } // namespace dart 1310 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/platform/json.h » ('j') | runtime/platform/json.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698