OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 ic->disconnectFrontend(); | 216 ic->disconnectFrontend(); |
217 ic->hideHighlight(); | 217 ic->hideHighlight(); |
218 ic->close(); | 218 ic->close(); |
219 m_debuggerAgentImpl.set(0); | 219 m_debuggerAgentImpl.set(0); |
220 m_attached = false; | 220 m_attached = false; |
221 m_apuAgentEnabled = false; | 221 m_apuAgentEnabled = false; |
222 } | 222 } |
223 | 223 |
224 void WebDevToolsAgentImpl::frontendLoaded() | 224 void WebDevToolsAgentImpl::frontendLoaded() |
225 { | 225 { |
226 inspectorController()->connectFrontend(); | 226 connectFrontend(false); |
227 // We know that by this time injected script has already been pushed to the
backend. | |
228 m_client->runtimePropertyChanged(kFrontendConnectedFeatureName, inspectorCon
troller()->injectedScriptHost()->injectedScriptSource()); | |
229 } | 227 } |
230 | 228 |
231 void WebDevToolsAgentImpl::didNavigate() | 229 void WebDevToolsAgentImpl::didNavigate() |
232 { | 230 { |
233 ClientMessageLoopAdapter::didNavigate(); | 231 ClientMessageLoopAdapter::didNavigate(); |
234 DebuggerAgentManager::onNavigate(); | 232 DebuggerAgentManager::onNavigate(); |
235 } | 233 } |
236 | 234 |
237 void WebDevToolsAgentImpl::didClearWindowObject(WebFrameImpl* webframe) | 235 void WebDevToolsAgentImpl::didClearWindowObject(WebFrameImpl* webframe) |
238 { | 236 { |
(...skipping 22 matching lines...) Expand all Loading... |
261 else if (name == kTimelineFeatureName) | 259 else if (name == kTimelineFeatureName) |
262 setTimelineProfilingEnabled(value == "true"); | 260 setTimelineProfilingEnabled(value == "true"); |
263 else if (name == kResourceTrackingFeatureName) { | 261 else if (name == kResourceTrackingFeatureName) { |
264 InspectorController* ic = inspectorController(); | 262 InspectorController* ic = inspectorController(); |
265 if (value == "true") | 263 if (value == "true") |
266 ic->enableResourceTracking(false /* not sticky */, false /* no reload
*/); | 264 ic->enableResourceTracking(false /* not sticky */, false /* no reload
*/); |
267 else | 265 else |
268 ic->disableResourceTracking(false /* not sticky */); | 266 ic->disableResourceTracking(false /* not sticky */); |
269 } else if (name == kFrontendConnectedFeatureName && !inspectorController()->
hasFrontend()) { | 267 } else if (name == kFrontendConnectedFeatureName && !inspectorController()->
hasFrontend()) { |
270 inspectorController()->injectedScriptHost()->setInjectedScriptSource(val
ue); | 268 inspectorController()->injectedScriptHost()->setInjectedScriptSource(val
ue); |
271 frontendLoaded(); | 269 connectFrontend(true); |
272 } | 270 } |
273 } | 271 } |
274 | 272 |
275 void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled) | 273 void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled) |
276 { | 274 { |
277 m_apuAgentEnabled = enabled; | 275 m_apuAgentEnabled = enabled; |
278 InspectorController* ic = inspectorController(); | 276 InspectorController* ic = inspectorController(); |
279 if (enabled) { | 277 if (enabled) { |
280 if (!ic->hasFrontend()) | 278 if (!ic->hasFrontend()) |
281 frontendLoaded(); | 279 connectFrontend(true); |
282 m_resourceTrackingWasEnabled = ic->resourceTrackingEnabled(); | 280 m_resourceTrackingWasEnabled = ic->resourceTrackingEnabled(); |
283 ic->startTimelineProfiler(); | 281 ic->startTimelineProfiler(); |
284 if (!m_resourceTrackingWasEnabled) { | 282 if (!m_resourceTrackingWasEnabled) { |
285 // TODO(knorton): Introduce some kind of agents dependency here so t
hat | 283 // TODO(knorton): Introduce some kind of agents dependency here so t
hat |
286 // user could turn off resource tracking while apu agent is on. | 284 // user could turn off resource tracking while apu agent is on. |
287 ic->enableResourceTracking(false, false); | 285 ic->enableResourceTracking(false, false); |
288 } | 286 } |
289 m_debuggerAgentImpl->setAutoContinueOnException(true); | 287 m_debuggerAgentImpl->setAutoContinueOnException(true); |
290 } else { | 288 } else { |
291 ic->stopTimelineProfiler(); | 289 ic->stopTimelineProfiler(); |
292 if (!m_resourceTrackingWasEnabled) | 290 if (!m_resourceTrackingWasEnabled) |
293 ic->disableResourceTracking(false); | 291 ic->disableResourceTracking(false); |
294 m_resourceTrackingWasEnabled = false; | 292 m_resourceTrackingWasEnabled = false; |
295 } | 293 } |
296 m_client->runtimePropertyChanged( | 294 m_client->runtimePropertyChanged( |
297 kApuAgentFeatureName, | 295 kApuAgentFeatureName, |
298 enabled ? String("true") : String("false")); | 296 enabled ? String("true") : String("false")); |
299 } | 297 } |
300 | 298 |
| 299 void WebDevToolsAgentImpl::connectFrontend(bool afterNavigation) |
| 300 { |
| 301 if (afterNavigation) |
| 302 inspectorController()->reuseFrontend(); |
| 303 else |
| 304 inspectorController()->connectFrontend(); |
| 305 // We know that by this time injected script has already been pushed to the
backend. |
| 306 m_client->runtimePropertyChanged(kFrontendConnectedFeatureName, inspectorCon
troller()->injectedScriptHost()->injectedScriptSource()); |
| 307 } |
| 308 |
301 WebCore::InspectorController* WebDevToolsAgentImpl::inspectorController() | 309 WebCore::InspectorController* WebDevToolsAgentImpl::inspectorController() |
302 { | 310 { |
303 if (Page* page = m_webViewImpl->page()) | 311 if (Page* page = m_webViewImpl->page()) |
304 return page->inspectorController(); | 312 return page->inspectorController(); |
305 return 0; | 313 return 0; |
306 } | 314 } |
307 | 315 |
308 | 316 |
309 //------- plugin resource load notifications --------------- | 317 //------- plugin resource load notifications --------------- |
310 void WebDevToolsAgentImpl::identifierForInitialRequest( | 318 void WebDevToolsAgentImpl::identifierForInitialRequest( |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 { | 496 { |
489 WebCore::ScriptDebugServer::shared().runPendingTasks(); | 497 WebCore::ScriptDebugServer::shared().runPendingTasks(); |
490 } | 498 } |
491 | 499 |
492 void WebDevToolsAgent::setMessageLoopDispatchHandler(MessageLoopDispatchHandler
handler) | 500 void WebDevToolsAgent::setMessageLoopDispatchHandler(MessageLoopDispatchHandler
handler) |
493 { | 501 { |
494 DebuggerAgentManager::setMessageLoopDispatchHandler(handler); | 502 DebuggerAgentManager::setMessageLoopDispatchHandler(handler); |
495 } | 503 } |
496 | 504 |
497 } // namespace WebKit | 505 } // namespace WebKit |
OLD | NEW |