Commit f4ae8f29 authored by Fredrik Söderqvist's avatar Fredrik Söderqvist Committed by Chromium LUCI CQ

Pass const SharedBuffer to LocalFrame::ForceSynchronousDocumentInstall

This method shouldn't need to mutate the buffer. Clean up by adding some
local variables for the document and the associated parser while here.

Change-Id: Ic0f4541d557a07da833637906c01a1aa7dc37473
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2582220Reviewed-by: default avatarNate Chapin <japhet@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#835596}
parent 73fa3012
...@@ -2081,7 +2081,7 @@ bool LocalFrame::NeedsOcclusionTracking() const { ...@@ -2081,7 +2081,7 @@ bool LocalFrame::NeedsOcclusionTracking() const {
void LocalFrame::ForceSynchronousDocumentInstall( void LocalFrame::ForceSynchronousDocumentInstall(
const AtomicString& mime_type, const AtomicString& mime_type,
scoped_refptr<SharedBuffer> data) { scoped_refptr<const SharedBuffer> data) {
CHECK(GetDocument()->IsInitialEmptyDocument()); CHECK(GetDocument()->IsInitialEmptyDocument());
DCHECK(!Client()->IsLocalFrameClientImpl()); DCHECK(!Client()->IsLocalFrameClientImpl());
...@@ -2090,20 +2090,20 @@ void LocalFrame::ForceSynchronousDocumentInstall( ...@@ -2090,20 +2090,20 @@ void LocalFrame::ForceSynchronousDocumentInstall(
GetDocument()->Shutdown(); GetDocument()->Shutdown();
DomWindow()->ClearForReuse(); DomWindow()->ClearForReuse();
DomWindow()->InstallNewDocument(DocumentInit::Create() Document* document =
.WithWindow(DomWindow(), nullptr) DomWindow()->InstallNewDocument(DocumentInit::Create()
.WithTypeFrom(mime_type)); .WithWindow(DomWindow(), nullptr)
.WithTypeFrom(mime_type));
GetDocument()->OpenForNavigation(kForceSynchronousParsing, mime_type, DocumentParser* parser = document->OpenForNavigation(
AtomicString("UTF-8")); kForceSynchronousParsing, mime_type, AtomicString("UTF-8"));
for (const auto& segment : *data) for (const auto& segment : *data)
GetDocument()->Parser()->AppendBytes(segment.data(), segment.size()); parser->AppendBytes(segment.data(), segment.size());
GetDocument()->Parser()->Finish(); parser->Finish();
// Upon loading of SVGImages, log PageVisits in UseCounter. // Upon loading of SVGImages, log PageVisits in UseCounter.
// Do not track PageVisits for inspector, web page popups, and validation // Do not track PageVisits for inspector, web page popups, and validation
// message overlays (the other callers of this method). // message overlays (the other callers of this method).
if (GetDocument()->IsSVGDocument()) if (document->IsSVGDocument())
loader_.GetDocumentLoader()->GetUseCounterHelper().DidCommitLoad(this); loader_.GetDocumentLoader()->GetUseCounterHelper().DidCommitLoad(this);
} }
......
...@@ -457,7 +457,7 @@ class CORE_EXPORT LocalFrame final ...@@ -457,7 +457,7 @@ class CORE_EXPORT LocalFrame final
// |mime_type| and populated with the contents of |data|. Only intended for // |mime_type| and populated with the contents of |data|. Only intended for
// use in internal-implementation LocalFrames that aren't in the frame tree. // use in internal-implementation LocalFrames that aren't in the frame tree.
void ForceSynchronousDocumentInstall(const AtomicString& mime_type, void ForceSynchronousDocumentInstall(const AtomicString& mime_type,
scoped_refptr<SharedBuffer> data); scoped_refptr<const SharedBuffer> data);
bool should_send_resource_timing_info_to_parent() const { bool should_send_resource_timing_info_to_parent() const {
return should_send_resource_timing_info_to_parent_; return should_send_resource_timing_info_to_parent_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment