OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 { | 404 { |
405 var profilesCount = this._profiles.length; | 405 var profilesCount = this._profiles.length; |
406 for (var i = 0; i < profilesCount; ++i) | 406 for (var i = 0; i < profilesCount; ++i) |
407 if (this._profiles[i].typeId === profile.typeId | 407 if (this._profiles[i].typeId === profile.typeId |
408 && this._profiles[i].uid === profile.uid) { | 408 && this._profiles[i].uid === profile.uid) { |
409 this._profiles[i] = profile; | 409 this._profiles[i] = profile; |
410 break; | 410 break; |
411 } | 411 } |
412 }, | 412 }, |
413 | 413 |
| 414 loadHeapSnapshot: function(uid, callback) |
| 415 { |
| 416 var profile = this._profilesIdMap[this._makeKey(uid, WebInspector.HeapSn
apshotProfileType.TypeId)]; |
| 417 if (!profile) |
| 418 return; |
| 419 |
| 420 if (profile._loaded) |
| 421 callback(profile); |
| 422 else if (profile._is_loading) |
| 423 profile._callbacks.push(callback); |
| 424 else { |
| 425 profile._is_loading = true; |
| 426 profile._callbacks = [callback]; |
| 427 profile._json = ""; |
| 428 InspectorBackend.getProfile(profile.typeId, profile.uid); |
| 429 } |
| 430 }, |
| 431 |
| 432 addHeapSnapshotChunk: function(uid, chunk) |
| 433 { |
| 434 var profile = this._profilesIdMap[this._makeKey(uid, WebInspector.HeapSn
apshotProfileType.TypeId)]; |
| 435 if (!profile || profile._loaded || !profile._is_loading) |
| 436 return; |
| 437 |
| 438 profile._json += chunk; |
| 439 }, |
| 440 |
| 441 finishHeapSnapshot: function(uid) |
| 442 { |
| 443 var profile = this._profilesIdMap[this._makeKey(uid, WebInspector.HeapSn
apshotProfileType.TypeId)]; |
| 444 if (!profile || profile._loaded || !profile._is_loading) |
| 445 return; |
| 446 |
| 447 var callbacks = profile._callbacks; |
| 448 delete profile._callbacks; |
| 449 var loadedSnapshot = JSON.parse(profile._json); |
| 450 delete profile._json; |
| 451 delete profile._is_loading; |
| 452 profile._loaded = true; |
| 453 WebInspector.HeapSnapshotView.prototype.processLoadedSnapshot(profile, l
oadedSnapshot); |
| 454 for (var i = 0; i < callbacks.length; ++i) |
| 455 callbacks[i](profile); |
| 456 }, |
| 457 |
414 showView: function(view) | 458 showView: function(view) |
415 { | 459 { |
416 this.showProfile(view.profile); | 460 this.showProfile(view.profile); |
417 }, | 461 }, |
418 | 462 |
419 getProfileType: function(typeId) | 463 getProfileType: function(typeId) |
420 { | 464 { |
421 return this._profileTypesByIdMap[typeId]; | 465 return this._profileTypesByIdMap[typeId]; |
422 }, | 466 }, |
423 | 467 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 WebInspector.ProfileGroupSidebarTreeElement.prototype = { | 691 WebInspector.ProfileGroupSidebarTreeElement.prototype = { |
648 onselect: function() | 692 onselect: function() |
649 { | 693 { |
650 if (this.children.length > 0) | 694 if (this.children.length > 0) |
651 WebInspector.panels.profiles.showProfile(this.children[this.children
.length - 1].profile); | 695 WebInspector.panels.profiles.showProfile(this.children[this.children
.length - 1].profile); |
652 } | 696 } |
653 } | 697 } |
654 | 698 |
655 WebInspector.ProfileGroupSidebarTreeElement.prototype.__proto__ = WebInspector.S
idebarTreeElement.prototype; | 699 WebInspector.ProfileGroupSidebarTreeElement.prototype.__proto__ = WebInspector.S
idebarTreeElement.prototype; |
656 | 700 |
OLD | NEW |