OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project 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 // Default number of frames to include in the response to backtrace request. | 5 // Default number of frames to include in the response to backtrace request. |
6 var kDefaultBacktraceLength = 10; | 6 var kDefaultBacktraceLength = 10; |
7 | 7 |
8 var Debug = {}; | 8 var Debug = {}; |
9 | 9 |
10 // Regular expression to skip "crud" at the beginning of a source line which is | 10 // Regular expression to skip "crud" at the beginning of a source line which is |
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1195 o.data = script.data(); | 1195 o.data = script.data(); |
1196 } | 1196 } |
1197 if (include_source) { | 1197 if (include_source) { |
1198 o.source = script.source(); | 1198 o.source = script.source(); |
1199 } | 1199 } |
1200 return o; | 1200 return o; |
1201 } | 1201 } |
1202 | 1202 |
1203 | 1203 |
1204 function MakePromiseEvent(event_data) { | 1204 function MakePromiseEvent(event_data) { |
1205 if (event_data.type = "new Promise") { | 1205 if (event_data.type == "new") { |
1206 return new NewPromiseEvent(event_data); | 1206 return new NewPromiseEvent(event_data); |
1207 } | 1207 } |
| 1208 if (event_data.type == "update") { |
| 1209 return new UpdatePromiseStatusEvent(event_data); |
| 1210 } |
| 1211 if (event_data.type == "chain") { |
| 1212 return new UpdatePromiseParentEvent(event_data); |
| 1213 } |
1208 } | 1214 } |
1209 | 1215 |
1210 | 1216 |
1211 function PromiseGetter() { | 1217 function PromiseGetter() { |
1212 return MakeMirror(this.promise_); | 1218 return MakeMirror(this.promise_); |
1213 } | 1219 } |
1214 | 1220 |
1215 | 1221 |
1216 function NewPromiseEvent(event_data) { | 1222 function NewPromiseEvent(event_data) { |
1217 this.resolver_ = event_data.resolver; | 1223 this.resolver_ = event_data.resolver; |
1218 this.promise_ = event_data.promise; | 1224 this.promise_ = event_data.promise; |
1219 } | 1225 } |
1220 | 1226 |
1221 | 1227 |
1222 NewPromiseEvent.prototype.promise = PromiseGetter; | 1228 NewPromiseEvent.prototype.promise = PromiseGetter; |
1223 | 1229 |
1224 | 1230 |
1225 NewPromiseEvent.prototype.resolver = function() { | 1231 NewPromiseEvent.prototype.resolver = function() { |
1226 return MakeMirror(this.resolver_); | 1232 return MakeMirror(this.resolver_); |
1227 } | 1233 } |
1228 | 1234 |
1229 | 1235 |
| 1236 function UpdatePromiseStatusEvent(event_data) { |
| 1237 this.promise_ = event_data.promise; |
| 1238 this.status_ = event_data.status; |
| 1239 this.value_ = event_data.value; |
| 1240 } |
| 1241 |
| 1242 |
| 1243 UpdatePromiseStatusEvent.prototype.promise = PromiseGetter; |
| 1244 |
| 1245 |
| 1246 UpdatePromiseStatusEvent.prototype.status = function() { |
| 1247 return this.status_; |
| 1248 } |
| 1249 |
| 1250 |
| 1251 UpdatePromiseStatusEvent.prototype.value = function() { |
| 1252 return MakeMirror(this.value_); |
| 1253 } |
| 1254 |
| 1255 |
| 1256 function UpdatePromiseParentEvent(event_data) { |
| 1257 this.promise_ = event_data.promise; |
| 1258 this.parentPromise_ = event_data.parentPromise; |
| 1259 } |
| 1260 |
| 1261 |
| 1262 UpdatePromiseParentEvent.prototype.promise = PromiseGetter; |
| 1263 |
| 1264 |
| 1265 UpdatePromiseParentEvent.prototype.parentPromise = function() { |
| 1266 return MakeMirror(this.parentPromise_); |
| 1267 } |
| 1268 |
| 1269 |
1230 function MakeAsyncTaskEvent(event_data) { | 1270 function MakeAsyncTaskEvent(event_data) { |
1231 return new AsyncTaskEvent(event_data); | 1271 return new AsyncTaskEvent(event_data); |
1232 } | 1272 } |
1233 | 1273 |
1234 | 1274 |
1235 function AsyncTaskEvent(event_data) { | 1275 function AsyncTaskEvent(event_data) { |
1236 this.type_ = event_data.type; | 1276 this.type_ = event_data.type; |
1237 this.name_ = event_data.name; | 1277 this.name_ = event_data.name; |
1238 this.id_ = event_data.id; | 1278 this.id_ = event_data.id; |
1239 } | 1279 } |
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2568 | 2608 |
2569 default: | 2609 default: |
2570 json = null; | 2610 json = null; |
2571 } | 2611 } |
2572 return json; | 2612 return json; |
2573 } | 2613 } |
2574 | 2614 |
2575 Debug.TestApi = { | 2615 Debug.TestApi = { |
2576 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ | 2616 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ |
2577 }; | 2617 }; |
OLD | NEW |