Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1370)

Side by Side Diff: sky/engine/core/html/parser/HTMLDocumentParser.cpp

Issue 889823002: Remove TRACE_EVENT indirection through blink::Platform (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19 matching lines...) Expand all
30 #include "gen/sky/core/HTMLNames.h" 30 #include "gen/sky/core/HTMLNames.h"
31 #include "sky/engine/core/css/MediaValuesCached.h" 31 #include "sky/engine/core/css/MediaValuesCached.h"
32 #include "sky/engine/core/dom/Element.h" 32 #include "sky/engine/core/dom/Element.h"
33 #include "sky/engine/core/frame/LocalFrame.h" 33 #include "sky/engine/core/frame/LocalFrame.h"
34 #include "sky/engine/core/html/HTMLScriptElement.h" 34 #include "sky/engine/core/html/HTMLScriptElement.h"
35 #include "sky/engine/core/html/parser/AtomicHTMLToken.h" 35 #include "sky/engine/core/html/parser/AtomicHTMLToken.h"
36 #include "sky/engine/core/html/parser/BackgroundHTMLParser.h" 36 #include "sky/engine/core/html/parser/BackgroundHTMLParser.h"
37 #include "sky/engine/core/html/parser/HTMLParserScheduler.h" 37 #include "sky/engine/core/html/parser/HTMLParserScheduler.h"
38 #include "sky/engine/core/html/parser/HTMLParserThread.h" 38 #include "sky/engine/core/html/parser/HTMLParserThread.h"
39 #include "sky/engine/core/html/parser/HTMLTreeBuilder.h" 39 #include "sky/engine/core/html/parser/HTMLTreeBuilder.h"
40 #include "sky/engine/core/inspector/InspectorTraceEvents.h"
41 #include "sky/engine/platform/SharedBuffer.h" 40 #include "sky/engine/platform/SharedBuffer.h"
42 #include "sky/engine/platform/TraceEvent.h" 41 #include "sky/engine/platform/TraceEvent.h"
43 42
44 namespace blink { 43 namespace blink {
45 44
46 HTMLDocumentParser::HTMLDocumentParser(Document& document, bool reportErrors) 45 HTMLDocumentParser::HTMLDocumentParser(Document& document, bool reportErrors)
47 : DocumentParser(&document) 46 : DocumentParser(&document)
48 , m_treeBuilder(HTMLTreeBuilder::create(this, &document, reportErrors)) 47 , m_treeBuilder(HTMLTreeBuilder::create(this, &document, reportErrors))
49 , m_parserScheduler(HTMLParserScheduler::create(this)) 48 , m_parserScheduler(HTMLParserScheduler::create(this))
50 , m_weakFactory(this) 49 , m_weakFactory(this)
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 void HTMLDocumentParser::pumpPendingSpeculations() 232 void HTMLDocumentParser::pumpPendingSpeculations()
234 { 233 {
235 // FIXME: Share this constant with the parser scheduler. 234 // FIXME: Share this constant with the parser scheduler.
236 const double parserTimeLimit = 0.500; 235 const double parserTimeLimit = 0.500;
237 236
238 // ASSERT that this object is both attached to the Document and protected. 237 // ASSERT that this object is both attached to the Document and protected.
239 ASSERT(refCount() >= 2); 238 ASSERT(refCount() >= 2);
240 ASSERT(!isWaitingForScripts()); 239 ASSERT(!isWaitingForScripts());
241 ASSERT(!isStopped()); 240 ASSERT(!isStopped());
242 241
243 // FIXME: Pass in current input length.
244 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTM L", "beginData", InspectorParseHtmlEvent::beginData(document(), lineNumber().zer oBasedInt()));
245 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current CallStack());
246
247 double startTime = currentTime(); 242 double startTime = currentTime();
248 243
249 while (!m_speculations.isEmpty()) { 244 while (!m_speculations.isEmpty()) {
250 processParsedChunkFromBackgroundParser(m_speculations.takeFirst()); 245 processParsedChunkFromBackgroundParser(m_speculations.takeFirst());
251 246
252 // Always check isStopped first as m_document may be null. 247 // Always check isStopped first as m_document may be null.
253 if (isStopped() || isWaitingForScripts() || !document()->haveImportsLoad ed()) 248 if (isStopped() || isWaitingForScripts() || !document()->haveImportsLoad ed())
254 break; 249 break;
255 250
256 if (currentTime() - startTime > parserTimeLimit && !m_speculations.isEmp ty()) { 251 if (currentTime() - startTime > parserTimeLimit && !m_speculations.isEmp ty()) {
257 m_parserScheduler->scheduleForResume(); 252 m_parserScheduler->scheduleForResume();
258 break; 253 break;
259 } 254 }
260 } 255 }
261
262 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML" , "endLine", lineNumber().zeroBasedInt());
263 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEvent::data ());
264 } 256 }
265 257
266 Document* HTMLDocumentParser::contextForParsingSession() 258 Document* HTMLDocumentParser::contextForParsingSession()
267 { 259 {
268 // The parsing session should interact with the document only when parsing 260 // The parsing session should interact with the document only when parsing
269 // non-fragments. Otherwise, we might delay the load event mistakenly. 261 // non-fragments. Otherwise, we might delay the load event mistakenly.
270 if (isParsingFragment()) 262 if (isParsingFragment())
271 return 0; 263 return 0;
272 return document(); 264 return document();
273 } 265 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 m_scriptRunner.executePendingScripts(); 379 m_scriptRunner.executePendingScripts();
388 ASSERT(!isExecutingScript()); 380 ASSERT(!isExecutingScript());
389 ASSERT(!isWaitingForScripts()); 381 ASSERT(!isWaitingForScripts());
390 if (m_speculations.isEmpty()) 382 if (m_speculations.isEmpty())
391 return; 383 return;
392 ASSERT(m_haveBackgroundParser); 384 ASSERT(m_haveBackgroundParser);
393 pumpPendingSpeculations(); 385 pumpPendingSpeculations();
394 } 386 }
395 387
396 } 388 }
OLDNEW
« no previous file with comments | « sky/engine/core/frame/LocalDOMWindow.cpp ('k') | sky/engine/core/inspector/InspectorTraceEvents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698