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

Issue 17640007: Refactoring: Simplify DocumentWriter by reorganizing its lifetime. (Closed)

Created:
7 years, 6 months ago by Hajime Morrita
Modified:
7 years, 5 months ago
Reviewers:
abarth-chromium
CC:
blink-reviews, caseq+blink_chromium.org, Nate Chapin, loislo+blink_chromium.org, eustas+blink_chromium.org, alph+blink_chromium.org, eae+blinkwatch, yurys+blink_chromium.org, lushnikov+blink_chromium.org, vsevik+blink_chromium.org, pfeldman+blink_chromium.org, dglazkov+blink, apavlov+blink_chromium.org, adamk+blink_chromium.org, pdr, f(malita), Stephen Chennney, aandrey+blink_chromium.org, gavinp+loader_chromium.org
Visibility:
Public.

Description

Refactoring: Simplify DocumentWriter by reorganizing its lifetime. This change simplifies DocumentWriter by 1. Letting its lifetime match to the actual "writing" process: It is now created when actual data is arrived to be parsed, and is discarded once all the data is loaded. Then we no longer neeed DocumentWriter::m_state. 2. Moving most of its Frame dependency to DocumentLoader. DocumentWriter::begin() is factored to DocumentLoader::createWriter(), and DocumentWriter::replaceDocument is factored to DocumentLoader::replaceDocument() and DocumentWriter::appendReplacingData(). DocumentWriter::m_frame is now able to be replaced by DocumentWriter::m_documnet. This narrows the dependency surface. (Also it makes more sense because it is "document" writer after all.) 3. Making TextResourceDecoderBuilder an immutable object by stripping its setters out. Note that (2) and (3) become possible because of (1). Key observations here are that - DocumentWriter had longer lifetime just because it stored mimetype and encoding. However, these can be computed on the fly in DocumentLoader when it starts actual writing. See ensureWriter() callsites. - Some of extra states in DocumentWriter was needed because it had to "reset" itself. Once its lifetime aligns the single loading/parsing, we no longer need such reset thing. - The main reason of dependency from DocumentWriter to Frame was DocumentWriter::begin(), which did connect the fresh, to-be-built Document and given Frame. This should be part of the DocumentWriter creation process and doesn't need to be in DocumentWriter itself. This change factors such setup into DocumentLoader::createWriter factory method. BUG=none TEST=none R=abarth@chromium.org Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=153115 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=153125 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=153216 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=153318

Patch Set 1 #

Patch Set 2 : Fixed a test failure. #

Patch Set 3 : Fixed a build breakage #

Total comments: 6

Patch Set 4 : Fixed another failure.w #

Patch Set 5 : Fixed yet anotehr test failure. #

Patch Set 6 : Fixed a test on content_browsertests, added a test for covering base url. #

Patch Set 7 : Re-landing after fixing ASAN failure on set-parent-src-synchronously.xhtml. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+205 lines, -214 lines) Patch
A + LayoutTests/mhtml/base_url.mht View 1 2 3 4 5 1 chunk +8 lines, -5 lines 0 comments Download
A + LayoutTests/mhtml/base_url-expected.txt View 1 2 3 4 5 0 chunks +-1 lines, --1 lines 0 comments Download
M Source/WebKit/chromium/src/WebHelperPluginImpl.cpp View 6 1 chunk +1 line, -1 line 0 comments Download
M Source/WebKit/chromium/src/WebPagePopupImpl.cpp View 6 1 chunk +1 line, -1 line 0 comments Download
M Source/core/dom/Document.h View 1 2 3 4 6 1 chunk +1 line, -1 line 0 comments Download
M Source/core/dom/Document.cpp View 1 2 3 4 5 6 2 chunks +3 lines, -1 line 0 comments Download
M Source/core/dom/RawDataDocumentParser.h View 6 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/inspector/InspectorOverlay.cpp View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M Source/core/loader/DocumentLoader.h View 1 2 3 4 5 6 5 chunks +8 lines, -3 lines 0 comments Download
M Source/core/loader/DocumentLoader.cpp View 1 2 3 4 5 6 11 chunks +104 lines, -49 lines 0 comments Download
M Source/core/loader/DocumentWriter.h View 1 2 3 4 5 6 2 chunks +14 lines, -19 lines 0 comments Download
M Source/core/loader/DocumentWriter.cpp View 1 2 3 4 5 6 4 chunks +39 lines, -118 lines 0 comments Download
M Source/core/loader/FrameLoader.cpp View 1 2 3 4 5 6 1 chunk +1 line, -2 lines 0 comments Download
M Source/core/loader/TextResourceDecoderBuilder.h View 1 2 3 6 2 chunks +5 lines, -4 lines 0 comments Download
M Source/core/loader/TextResourceDecoderBuilder.cpp View 6 2 chunks +4 lines, -8 lines 0 comments Download
M Source/core/svg/graphics/SVGImage.cpp View 1 2 3 4 6 1 chunk +1 line, -1 line 0 comments Download
M Source/core/testing/Internals.h View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/testing/Internals.cpp View 1 2 3 4 5 1 chunk +10 lines, -0 lines 0 comments Download
M Source/core/testing/Internals.idl View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/testing/MockPagePopupDriver.cpp View 6 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 13 (0 generated)
Hajime Morrita
Adam, could you take a look? This is the last bit of DocumentLoader refactoring series, ...
7 years, 6 months ago (2013-06-26 01:39:29 UTC) #1
abarth-chromium
lgtm https://codereview.chromium.org/17640007/diff/5001/Source/core/loader/DocumentLoader.cpp File Source/core/loader/DocumentLoader.cpp (right): https://codereview.chromium.org/17640007/diff/5001/Source/core/loader/DocumentLoader.cpp#newcode643 Source/core/loader/DocumentLoader.cpp:643: return; Should we ASSERT that the mimeTypes match? ...
7 years, 6 months ago (2013-06-26 03:04:07 UTC) #2
Hajime Morrita
Thanks for the quick review. I'll address the point and fix remaining failures, then land ...
7 years, 6 months ago (2013-06-26 04:24:39 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/morrita@chromium.org/17640007/16001
7 years, 6 months ago (2013-06-27 02:22:56 UTC) #4
commit-bot: I haz the power
Change committed as 153115
7 years, 5 months ago (2013-06-27 04:11:14 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/morrita@chromium.org/17640007/16001
7 years, 5 months ago (2013-06-27 08:33:15 UTC) #6
commit-bot: I haz the power
Change committed as 153125
7 years, 5 months ago (2013-06-27 08:33:46 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/morrita@chromium.org/17640007/31001
7 years, 5 months ago (2013-06-28 02:12:05 UTC) #8
commit-bot: I haz the power
Failed to apply patch for LayoutTests/mhtml/base_url.mht: While running patch -p1 --forward --force --no-backup-if-mismatch; A LayoutTests/mhtml/base_url.mht ...
7 years, 5 months ago (2013-06-28 02:12:10 UTC) #9
Hajime Morrita
Committed patchset #6 manually as r153216 (presubmit successful).
7 years, 5 months ago (2013-06-28 07:52:31 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/morrita@chromium.org/17640007/37001
7 years, 5 months ago (2013-07-01 03:41:20 UTC) #11
commit-bot: I haz the power
Failed to apply patch for LayoutTests/mhtml/base_url.mht: While running patch -p1 --forward --force --no-backup-if-mismatch; A LayoutTests/mhtml/base_url.mht ...
7 years, 5 months ago (2013-07-01 03:41:25 UTC) #12
Hajime Morrita
7 years, 5 months ago (2013-07-01 04:45:16 UTC) #13
Message was sent while issue was closed.
Committed patchset #7 manually as r153318 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698