| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium 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 /** | 5 /** |
| 6 * @fileoverview Provides communication interface to remote v8 debugger. See | 6 * @fileoverview Provides communication interface to remote v8 debugger. See |
| 7 * protocol decription at http://code.google.com/p/v8/wiki/DebuggerProtocol | 7 * protocol decription at http://code.google.com/p/v8/wiki/DebuggerProtocol |
| 8 */ | 8 */ |
| 9 goog.provide('devtools.DebuggerAgent'); | 9 goog.provide('devtools.DebuggerAgent'); |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 */ | 55 */ |
| 56 this.pauseOnExceptions_ = true; | 56 this.pauseOnExceptions_ = true; |
| 57 | 57 |
| 58 /** | 58 /** |
| 59 * Mapping: request sequence number->callback. | 59 * Mapping: request sequence number->callback. |
| 60 * @type {Object} | 60 * @type {Object} |
| 61 */ | 61 */ |
| 62 this.requestSeqToCallback_ = null; | 62 this.requestSeqToCallback_ = null; |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * Whether the scripts list has been requested. | 65 * Whether the scripts panel has been shown and initialilzed. |
| 66 * @type {boolean} | 66 * @type {boolean} |
| 67 */ | 67 */ |
| 68 this.scriptsCacheInitialized_ = false; | 68 this.scriptsPanelInitialized_ = false; |
| 69 | 69 |
| 70 /** | 70 /** |
| 71 * Whether the scripts list should be requested next time when context id is | 71 * Whether the scripts list should be requested next time when context id is |
| 72 * set. | 72 * set. |
| 73 * @type {boolean} | 73 * @type {boolean} |
| 74 */ | 74 */ |
| 75 this.requestScriptsWhenContextIdSet_ = false; | 75 this.requestScriptsWhenContextIdSet_ = false; |
| 76 | 76 |
| 77 /** | 77 /** |
| 78 * Active profiler modules flags. | 78 * Active profiler modules flags. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // managed by an agent on the Render's side. | 148 // managed by an agent on the Render's side. |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 | 151 |
| 152 /** | 152 /** |
| 153 * Initializes scripts UI. This method is called every time Scripts panel | 153 * Initializes scripts UI. This method is called every time Scripts panel |
| 154 * is shown. It will send request for context id if it's not set yet. | 154 * is shown. It will send request for context id if it's not set yet. |
| 155 */ | 155 */ |
| 156 devtools.DebuggerAgent.prototype.initUI = function() { | 156 devtools.DebuggerAgent.prototype.initUI = function() { |
| 157 // Initialize scripts cache when Scripts panel is shown first time. | 157 // Initialize scripts cache when Scripts panel is shown first time. |
| 158 if (this.scriptsCacheInitialized_) { | 158 if (this.scriptsPanelInitialized_) { |
| 159 return; | 159 return; |
| 160 } | 160 } |
| 161 this.scriptsCacheInitialized_ = true; | 161 this.scriptsPanelInitialized_ = true; |
| 162 if (this.contextId_) { | 162 if (this.contextId_) { |
| 163 // We already have context id. This means that we are here from the | 163 // We already have context id. This means that we are here from the |
| 164 // very beginning of the page load cycle and hence will get all scripts | 164 // very beginning of the page load cycle and hence will get all scripts |
| 165 // via after-compile events. No need to request scripts for this session. | 165 // via after-compile events. No need to request scripts for this session. |
| 166 // |
| 167 // There can be a number of scripts from after-compile events that are |
| 168 // pending addition into the UI. |
| 169 for (var scriptId in this.parsedScripts_) { |
| 170 var script = this.parsedScripts_[scriptId]; |
| 171 WebInspector.parsedScriptSource(scriptId, script.getUrl(), |
| 172 undefined /* script source */, script.getLineOffset()); |
| 173 } |
| 166 return; | 174 return; |
| 167 } | 175 } |
| 168 // Script list should be requested only when current context id is known. | 176 // Script list should be requested only when current context id is known. |
| 169 RemoteDebuggerAgent.GetContextId(); | 177 RemoteDebuggerAgent.GetContextId(); |
| 170 this.requestScriptsWhenContextIdSet_ = true; | 178 this.requestScriptsWhenContextIdSet_ = true; |
| 171 }; | 179 }; |
| 172 | 180 |
| 173 | 181 |
| 174 /** | 182 /** |
| 175 * Asynchronously requests the debugger for the script source. | 183 * Asynchronously requests the debugger for the script source. |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 * is not in the cache yet. | 1034 * is not in the cache yet. |
| 1027 * @param {Object} script Script json object from the debugger message. | 1035 * @param {Object} script Script json object from the debugger message. |
| 1028 * @param {devtools.DebuggerMessage} msg Debugger message containing the script | 1036 * @param {devtools.DebuggerMessage} msg Debugger message containing the script |
| 1029 * data. | 1037 * data. |
| 1030 */ | 1038 */ |
| 1031 devtools.DebuggerAgent.prototype.addScriptInfo_ = function(script, msg) { | 1039 devtools.DebuggerAgent.prototype.addScriptInfo_ = function(script, msg) { |
| 1032 var context = msg.lookup(script.context.ref); | 1040 var context = msg.lookup(script.context.ref); |
| 1033 var contextType = context.data.type; | 1041 var contextType = context.data.type; |
| 1034 this.parsedScripts_[script.id] = new devtools.ScriptInfo( | 1042 this.parsedScripts_[script.id] = new devtools.ScriptInfo( |
| 1035 script.id, script.name, script.lineOffset, contextType); | 1043 script.id, script.name, script.lineOffset, contextType); |
| 1036 if (WebInspector.panels.scripts.element.parentElement) { | 1044 if (this.scriptsPanelInitialized_) { |
| 1037 // Only report script as parsed after scripts panel has been shown. | 1045 // Only report script as parsed after scripts panel has been shown. |
| 1038 WebInspector.parsedScriptSource( | 1046 WebInspector.parsedScriptSource( |
| 1039 script.id, script.name, script.source, script.lineOffset); | 1047 script.id, script.name, script.source, script.lineOffset); |
| 1040 } | 1048 } |
| 1041 }; | 1049 }; |
| 1042 | 1050 |
| 1043 | 1051 |
| 1044 /** | 1052 /** |
| 1045 * @param {devtools.DebuggerMessage} msg | 1053 * @param {devtools.DebuggerMessage} msg |
| 1046 */ | 1054 */ |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1567 | 1575 |
| 1568 | 1576 |
| 1569 /** | 1577 /** |
| 1570 * @param {number} handle Object handle. | 1578 * @param {number} handle Object handle. |
| 1571 * @return {?Object} Returns the object with the handle if it was sent in this | 1579 * @return {?Object} Returns the object with the handle if it was sent in this |
| 1572 * message(some objects referenced by handles may be missing in the message). | 1580 * message(some objects referenced by handles may be missing in the message). |
| 1573 */ | 1581 */ |
| 1574 devtools.DebuggerMessage.prototype.lookup = function(handle) { | 1582 devtools.DebuggerMessage.prototype.lookup = function(handle) { |
| 1575 return this.refs_[handle]; | 1583 return this.refs_[handle]; |
| 1576 }; | 1584 }; |
| OLD | NEW |