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 These stubs emulate backend functionality and allows | 6 * @fileoverview These stubs emulate backend functionality and allows |
7 * DevTools frontend to function as a standalone web app. | 7 * DevTools frontend to function as a standalone web app. |
8 */ | 8 */ |
9 | 9 |
10 /** | 10 /** |
11 * @constructor | 11 * @constructor |
12 */ | 12 */ |
13 RemoteDebuggerAgentStub = function() { | 13 RemoteDebuggerAgentStub = function() { |
| 14 this.isProfiling_ = false; |
14 }; | 15 }; |
15 | 16 |
16 RemoteDebuggerAgentStub.prototype.DebugBreak = function() { | 17 RemoteDebuggerAgentStub.prototype.DebugBreak = function() { |
17 }; | 18 }; |
18 | 19 |
19 RemoteDebuggerAgentStub.prototype.GetContextId = function() { | 20 RemoteDebuggerAgentStub.prototype.GetContextId = function() { |
20 RemoteDebuggerAgent.DidGetContextId(3); | 21 RemoteDebuggerAgent.DidGetContextId(3); |
21 }; | 22 }; |
22 | 23 |
23 RemoteDebuggerAgentStub.prototype.StopProfiling = function() { | 24 RemoteDebuggerAgentStub.prototype.StopProfiling = function() { |
| 25 this.isProfiling_ = false; |
24 }; | 26 }; |
25 | 27 |
26 RemoteDebuggerAgentStub.prototype.StartProfiling = function() { | 28 RemoteDebuggerAgentStub.prototype.StartProfiling = function() { |
| 29 this.isProfiling_ = true; |
27 }; | 30 }; |
28 | 31 |
29 RemoteDebuggerAgentStub.prototype.IsProfilingStarted = function() { | 32 RemoteDebuggerAgentStub.prototype.IsProfilingStarted = function() { |
| 33 var self = this; |
30 setTimeout(function() { | 34 setTimeout(function() { |
31 RemoteDebuggerAgent.DidIsProfilingStarted(true); | 35 RemoteDebuggerAgent.DidIsProfilingStarted(self.isProfiling_); |
32 }, 100); | 36 }, 100); |
33 }; | 37 }; |
34 | 38 |
35 RemoteDebuggerAgentStub.prototype.GetLogLines = function(pos) { | 39 RemoteDebuggerAgentStub.prototype.GetLogLines = function(pos) { |
36 if (pos < RemoteDebuggerAgentStub.ProfilerLogBuffer.length) { | 40 if (pos < RemoteDebuggerAgentStub.ProfilerLogBuffer.length) { |
37 setTimeout(function() { | 41 setTimeout(function() { |
38 RemoteDebuggerAgent.DidGetLogLines( | 42 RemoteDebuggerAgent.DidGetLogLines( |
39 RemoteDebuggerAgentStub.ProfilerLogBuffer, | 43 RemoteDebuggerAgentStub.ProfilerLogBuffer, |
40 pos + RemoteDebuggerAgentStub.ProfilerLogBuffer.length); | 44 pos + RemoteDebuggerAgentStub.ProfilerLogBuffer.length); |
41 }, | 45 }, |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 JSON.stringify()); | 227 JSON.stringify()); |
224 }, 0); | 228 }, 0); |
225 }; | 229 }; |
226 | 230 |
227 | 231 |
228 RemoteToolsAgentStub.prototype.ClearConsoleMessages = function() { | 232 RemoteToolsAgentStub.prototype.ClearConsoleMessages = function() { |
229 }; | 233 }; |
230 | 234 |
231 | 235 |
232 RemoteDebuggerAgentStub.ProfilerLogBuffer = | 236 RemoteDebuggerAgentStub.ProfilerLogBuffer = |
| 237 'profiler,resume\n' + |
233 'code-creation,LazyCompile,0x1000,256,"test1 http://aaa.js:1"\n' + | 238 'code-creation,LazyCompile,0x1000,256,"test1 http://aaa.js:1"\n' + |
234 'code-creation,LazyCompile,0x2000,256,"test2 http://bbb.js:2"\n' + | 239 'code-creation,LazyCompile,0x2000,256,"test2 http://bbb.js:2"\n' + |
235 'code-creation,LazyCompile,0x3000,256,"test3 http://ccc.js:3"\n' + | 240 'code-creation,LazyCompile,0x3000,256,"test3 http://ccc.js:3"\n' + |
236 'tick,0x1010,0x0,3\n' + | 241 'tick,0x1010,0x0,3\n' + |
237 'tick,0x2020,0x0,3,0x1010\n' + | 242 'tick,0x2020,0x0,3,0x1010\n' + |
238 'tick,0x2020,0x0,3,0x1010\n' + | 243 'tick,0x2020,0x0,3,0x1010\n' + |
239 'tick,0x3010,0x0,3,0x2020, 0x1010\n' + | 244 'tick,0x3010,0x0,3,0x2020, 0x1010\n' + |
240 'tick,0x2020,0x0,3,0x1010\n' + | 245 'tick,0x2020,0x0,3,0x1010\n' + |
241 'tick,0x2030,0x0,3,0x2020, 0x1010\n' + | 246 'tick,0x2030,0x0,3,0x2020, 0x1010\n' + |
242 'tick,0x2020,0x0,3,0x1010\n' + | 247 'tick,0x2020,0x0,3,0x1010\n' + |
243 'tick,0x1010,0x0,3\n'; | 248 'tick,0x1010,0x0,3\n' + |
| 249 'profiler,pause\n'; |
244 | 250 |
245 | 251 |
246 /** | 252 /** |
247 * @constructor | 253 * @constructor |
248 */ | 254 */ |
249 RemoteDebuggerCommandExecutorStub = function() { | 255 RemoteDebuggerCommandExecutorStub = function() { |
250 }; | 256 }; |
251 | 257 |
252 | 258 |
253 RemoteDebuggerCommandExecutorStub.prototype.DebuggerCommand = function(cmd) { | 259 RemoteDebuggerCommandExecutorStub.prototype.DebuggerCommand = function(cmd) { |
(...skipping 17 matching lines...) Expand all Loading... |
271 | 277 |
272 | 278 |
273 if (!window['DevToolsHost']) { | 279 if (!window['DevToolsHost']) { |
274 window['RemoteDebuggerAgent'] = new RemoteDebuggerAgentStub(); | 280 window['RemoteDebuggerAgent'] = new RemoteDebuggerAgentStub(); |
275 window['RemoteDebuggerCommandExecutor'] = | 281 window['RemoteDebuggerCommandExecutor'] = |
276 new RemoteDebuggerCommandExecutorStub(); | 282 new RemoteDebuggerCommandExecutorStub(); |
277 window['RemoteDomAgent'] = new RemoteDomAgentStub(); | 283 window['RemoteDomAgent'] = new RemoteDomAgentStub(); |
278 window['RemoteToolsAgent'] = new RemoteToolsAgentStub(); | 284 window['RemoteToolsAgent'] = new RemoteToolsAgentStub(); |
279 window['DevToolsHost'] = new DevToolsHostStub(); | 285 window['DevToolsHost'] = new DevToolsHostStub(); |
280 } | 286 } |
OLD | NEW |