| 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 | 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 #if !ENABLE(OILPAN) | 265 #if !ENABLE(OILPAN) |
| 266 // ASSERT that this object is both attached to the Document and protected. | 266 // ASSERT that this object is both attached to the Document and protected. |
| 267 ASSERT(refCount() >= 2); | 267 ASSERT(refCount() >= 2); |
| 268 #endif | 268 #endif |
| 269 ASSERT(!m_lastChunkBeforeScript); | 269 ASSERT(!m_lastChunkBeforeScript); |
| 270 ASSERT(!isWaitingForScripts()); | 270 ASSERT(!isWaitingForScripts()); |
| 271 ASSERT(!isStopped()); | 271 ASSERT(!isStopped()); |
| 272 | 272 |
| 273 // FIXME: Pass in current input length. | 273 // FIXME: Pass in current input length. |
| 274 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTM
L", "beginData", InspectorParseHtmlEvent::beginData(document(), lineNumber().zer
oBasedInt())); | 274 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTM
L", "beginData", InspectorParseHtmlEvent::beginData(document(), lineNumber().zer
oBasedInt())); |
| 275 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 275 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); |
| 276 | 276 |
| 277 double startTime = currentTime(); | 277 double startTime = currentTime(); |
| 278 | 278 |
| 279 while (!m_speculations.isEmpty()) { | 279 while (!m_speculations.isEmpty()) { |
| 280 processParsedChunkFromBackgroundParser(m_speculations.takeFirst()); | 280 processParsedChunkFromBackgroundParser(m_speculations.takeFirst()); |
| 281 | 281 |
| 282 // Always check isStopped first as m_document may be null. | 282 // Always check isStopped first as m_document may be null. |
| 283 if (isStopped() || isWaitingForScripts()) | 283 if (isStopped() || isWaitingForScripts()) |
| 284 break; | 284 break; |
| 285 | 285 |
| 286 if (currentTime() - startTime > parserTimeLimit && !m_speculations.isEmp
ty()) { | 286 if (currentTime() - startTime > parserTimeLimit && !m_speculations.isEmp
ty()) { |
| 287 m_parserScheduler->scheduleForResume(); | 287 m_parserScheduler->scheduleForResume(); |
| 288 break; | 288 break; |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 | 291 |
| 292 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML"
, "endLine", lineNumber().zeroBasedInt()); | 292 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML"
, "endLine", lineNumber().zeroBasedInt()); |
| 293 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", "data", InspectorUpdateCountersEvent::data()); | 293 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEvent::data
()); |
| 294 } | 294 } |
| 295 | 295 |
| 296 Document* HTMLDocumentParser::contextForParsingSession() | 296 Document* HTMLDocumentParser::contextForParsingSession() |
| 297 { | 297 { |
| 298 // The parsing session should interact with the document only when parsing | 298 // The parsing session should interact with the document only when parsing |
| 299 // non-fragments. Otherwise, we might delay the load event mistakenly. | 299 // non-fragments. Otherwise, we might delay the load event mistakenly. |
| 300 if (isParsingFragment()) | 300 if (isParsingFragment()) |
| 301 return 0; | 301 return 0; |
| 302 return document(); | 302 return document(); |
| 303 } | 303 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 { | 426 { |
| 427 if (!m_scriptRunner.hasPendingScripts()) | 427 if (!m_scriptRunner.hasPendingScripts()) |
| 428 return; | 428 return; |
| 429 RefPtr<HTMLDocumentParser> protect(this); | 429 RefPtr<HTMLDocumentParser> protect(this); |
| 430 m_scriptRunner.executePendingScripts(); | 430 m_scriptRunner.executePendingScripts(); |
| 431 if (!isWaitingForScripts()) | 431 if (!isWaitingForScripts()) |
| 432 resumeParsingAfterScriptExecution(); | 432 resumeParsingAfterScriptExecution(); |
| 433 } | 433 } |
| 434 | 434 |
| 435 } | 435 } |
| OLD | NEW |