Remove a dangerous unused parameter in CssSummarizerBase::WillNotRenderSummary;

if it were actually used we would have a race.
This commit is contained in:
Maks Orlovich
2016-10-14 10:48:43 -04:00
parent b98ae97e1f
commit cdb517efa5
5 changed files with 20 additions and 32 deletions
@@ -297,8 +297,7 @@ void CriticalSelectorFilter::RenderSummary(
}
void CriticalSelectorFilter::WillNotRenderSummary(
int pos, HtmlElement* element, HtmlCharactersNode* char_node,
bool* is_element_deleted) {
int pos, HtmlElement* element, HtmlCharactersNode* char_node) {
RememberFullCss(pos, element, char_node);
}
+5 -12
View File
@@ -150,7 +150,7 @@ void CssSummarizerBase::Context::Render() {
if (num_output_partitions() == 0) {
// Failed at partition -> resource fetch failed or uncacheable.
summary_info.state = kSummaryInputUnavailable;
filter_->WillNotRenderSummary(pos_, element_, text_, &is_element_deleted);
filter_->WillNotRenderSummary(pos_, element_, text_);
} else {
const CachedResult& result = *output_partition(0);
// Transfer the summarization result from the metadata cache (where it was
@@ -171,7 +171,7 @@ void CssSummarizerBase::Context::Render() {
filter_->RenderSummary(pos_, element_, text_, &is_element_deleted);
} else {
summary_info.state = kSummaryCssParseError;
filter_->WillNotRenderSummary(pos_, element_, text_, &is_element_deleted);
filter_->WillNotRenderSummary(pos_, element_, text_);
}
}
if (is_element_deleted) {
@@ -181,11 +181,7 @@ void CssSummarizerBase::Context::Render() {
}
void CssSummarizerBase::Context::WillNotRender() {
bool is_element_deleted = false;
filter_->WillNotRenderSummary(pos_, element_, text_, &is_element_deleted);
if (is_element_deleted) {
slot(0)->set_disable_further_processing(true);
}
filter_->WillNotRenderSummary(pos_, element_, text_);
}
void CssSummarizerBase::Context::Cancel() {
@@ -288,8 +284,7 @@ void CssSummarizerBase::RenderSummary(
}
void CssSummarizerBase::WillNotRenderSummary(
int pos, HtmlElement* element, HtmlCharactersNode* char_node,
bool* is_element_deleted) {
int pos, HtmlElement* element, HtmlCharactersNode* char_node) {
}
void CssSummarizerBase::Clear() {
@@ -465,9 +460,7 @@ void CssSummarizerBase::StartExternalRewrite(
const char* url = src->DecodedValueOrNull();
summaries_.back().location = (url != NULL ? url : driver()->UrlLine());
bool is_element_deleted = false; // unused after call because no slot here
WillNotRenderSummary(summaries_.size() - 1, link, NULL /* char_node */,
&is_element_deleted);
WillNotRenderSummary(summaries_.size() - 1, link, nullptr /* char_node */);
// TODO(morlovich): Stat?
if (DebugMode()) {
@@ -111,10 +111,9 @@ class MinifyExcerptFilter : public CssSummarizerBase {
}
}
virtual void WillNotRenderSummary(int pos,
HtmlElement* element,
HtmlCharactersNode* char_node,
bool* is_element_deleted) {
void WillNotRenderSummary(int pos,
HtmlElement* element,
HtmlCharactersNode* char_node) override {
// Note that these should not normally mutate the DOM, we only
// get away with this because the tests we use this in don't really do
// any flushing.
@@ -81,16 +81,15 @@ class CriticalSelectorFilter : public CssSummarizerBase {
// write them out to the page. We also use this to pick up the output
// of filters before us, like rewrite_css; so we run this even on things
// that will not contain on-screen critical CSS.
virtual void Summarize(Css::Stylesheet* stylesheet,
GoogleString* out) const;
virtual void RenderSummary(int pos,
HtmlElement* element,
HtmlCharactersNode* char_node,
bool* is_element_deleted);
virtual void WillNotRenderSummary(int pos,
HtmlElement* element,
HtmlCharactersNode* char_node,
bool* is_element_deleted);
void Summarize(Css::Stylesheet* stylesheet,
GoogleString* out) const override;
void RenderSummary(int pos,
HtmlElement* element,
HtmlCharactersNode* char_node,
bool* is_element_deleted) override;
void WillNotRenderSummary(int pos,
HtmlElement* element,
HtmlCharactersNode* char_node) override;
// Since our computation depends on the selectors that are relevant to the
// webpage, we incorporate them into the cache key as well.
@@ -163,12 +163,10 @@ class CssSummarizerBase : public RewriteFilter {
//
// Like with RenderSummary, this corresponds to entry [pos] in the summary
// table, and elements points to the <link> or <style> containing CSS,
// with char_node being non-null in case it was a <style>. Overrides need
// to set is_element_deleted to true if they delete the element.
// with char_node being non-null in case it was a <style>.
virtual void WillNotRenderSummary(int pos,
HtmlElement* element,
HtmlCharactersNode* char_node,
bool* is_element_deleted);
HtmlCharactersNode* char_node);
// This is called at the end of the document when all outstanding summary
// computations have completed, regardless of whether successful or not. It