| 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 | |
| 458 showView: function(view) | 414 showView: function(view) |
| 459 { | 415 { |
| 460 this.showProfile(view.profile); | 416 this.showProfile(view.profile); |
| 461 }, | 417 }, |
| 462 | 418 |
| 463 getProfileType: function(typeId) | 419 getProfileType: function(typeId) |
| 464 { | 420 { |
| 465 return this._profileTypesByIdMap[typeId]; | 421 return this._profileTypesByIdMap[typeId]; |
| 466 }, | 422 }, |
| 467 | 423 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 WebInspector.ProfileGroupSidebarTreeElement.prototype = { | 647 WebInspector.ProfileGroupSidebarTreeElement.prototype = { |
| 692 onselect: function() | 648 onselect: function() |
| 693 { | 649 { |
| 694 if (this.children.length > 0) | 650 if (this.children.length > 0) |
| 695 WebInspector.panels.profiles.showProfile(this.children[this.children
.length - 1].profile); | 651 WebInspector.panels.profiles.showProfile(this.children[this.children
.length - 1].profile); |
| 696 } | 652 } |
| 697 } | 653 } |
| 698 | 654 |
| 699 WebInspector.ProfileGroupSidebarTreeElement.prototype.__proto__ = WebInspector.S
idebarTreeElement.prototype; | 655 WebInspector.ProfileGroupSidebarTreeElement.prototype.__proto__ = WebInspector.S
idebarTreeElement.prototype; |
| 700 | 656 |
| OLD | NEW |