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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp

Issue 2209283002: Fix HTMLDocumentParser::stopBackgroundParser crash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 , m_shouldUseThreading(syncPolicy == AllowAsynchronousParsing) 122 , m_shouldUseThreading(syncPolicy == AllowAsynchronousParsing)
123 , m_endWasDelayed(false) 123 , m_endWasDelayed(false)
124 , m_haveBackgroundParser(false) 124 , m_haveBackgroundParser(false)
125 , m_tasksWereSuspended(false) 125 , m_tasksWereSuspended(false)
126 , m_pumpSessionNestingLevel(0) 126 , m_pumpSessionNestingLevel(0)
127 , m_pumpSpeculationsSessionNestingLevel(0) 127 , m_pumpSpeculationsSessionNestingLevel(0)
128 , m_isParsingAtLineNumber(false) 128 , m_isParsingAtLineNumber(false)
129 , m_triedLoadingLinkHeaders(false) 129 , m_triedLoadingLinkHeaders(false)
130 { 130 {
131 ASSERT(shouldUseThreading() || (m_token && m_tokenizer)); 131 ASSERT(shouldUseThreading() || (m_token && m_tokenizer));
132 ThreadState::current()->registerPreFinalizer(this);
132 } 133 }
133 134
134 HTMLDocumentParser::~HTMLDocumentParser() 135 HTMLDocumentParser::~HTMLDocumentParser()
135 { 136 {
137 }
138
139 void HTMLDocumentParser::dispose()
140 {
136 // In Oilpan, HTMLDocumentParser can die together with Document, and 141 // In Oilpan, HTMLDocumentParser can die together with Document, and
137 // detach() is not called in this case. 142 // detach() is not called in this case.
138 if (m_haveBackgroundParser) 143 if (m_haveBackgroundParser)
139 stopBackgroundParser(); 144 stopBackgroundParser();
140 } 145 }
141 146
142 DEFINE_TRACE(HTMLDocumentParser) 147 DEFINE_TRACE(HTMLDocumentParser)
143 { 148 {
144 visitor->trace(m_treeBuilder); 149 visitor->trace(m_treeBuilder);
145 visitor->trace(m_parserScheduler); 150 visitor->trace(m_parserScheduler);
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 } 719 }
715 720
716 void HTMLDocumentParser::startBackgroundParser() 721 void HTMLDocumentParser::startBackgroundParser()
717 { 722 {
718 ASSERT(!isStopped()); 723 ASSERT(!isStopped());
719 ASSERT(shouldUseThreading()); 724 ASSERT(shouldUseThreading());
720 ASSERT(!m_haveBackgroundParser); 725 ASSERT(!m_haveBackgroundParser);
721 ASSERT(document()); 726 ASSERT(document());
722 m_haveBackgroundParser = true; 727 m_haveBackgroundParser = true;
723 728
729 // TODO(alexclarke): Remove WebFrameScheduler::setDocumentParsingInBackgroun d when background parser goes away.
724 if (document()->frame() && document()->frame()->frameScheduler()) 730 if (document()->frame() && document()->frame()->frameScheduler())
725 document()->frame()->frameScheduler()->setDocumentParsingInBackground(tr ue); 731 document()->frame()->frameScheduler()->setDocumentParsingInBackground(tr ue);
726 732
727 // Make sure that a resolver is set up, so that the correct viewport dimensi ons will be fed to the background parser and preload scanner. 733 // Make sure that a resolver is set up, so that the correct viewport dimensi ons will be fed to the background parser and preload scanner.
728 if (document()->loader()) 734 if (document()->loader())
729 document()->ensureStyleResolver(); 735 document()->ensureStyleResolver();
730 736
731 RefPtr<WeakReference<BackgroundHTMLParser>> reference = WeakReference<Backgr oundHTMLParser>::createUnbound(); 737 RefPtr<WeakReference<BackgroundHTMLParser>> reference = WeakReference<Backgr oundHTMLParser>::createUnbound();
732 m_backgroundParser = WeakPtr<BackgroundHTMLParser>(reference); 738 m_backgroundParser = WeakPtr<BackgroundHTMLParser>(reference);
733 739
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 (*WTF::bind(function, std::forward<Ps>(parameters)...))(); 1169 (*WTF::bind(function, std::forward<Ps>(parameters)...))();
1164 return; 1170 return;
1165 case Asynchronous: 1171 case Asynchronous:
1166 m_loadingTaskRunner->postTask(BLINK_FROM_HERE, WTF::bind(function, std:: forward<Ps>(parameters)...)); 1172 m_loadingTaskRunner->postTask(BLINK_FROM_HERE, WTF::bind(function, std:: forward<Ps>(parameters)...));
1167 return; 1173 return;
1168 } 1174 }
1169 NOTREACHED(); 1175 NOTREACHED();
1170 } 1176 }
1171 1177
1172 } // namespace blink 1178 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698