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

Issue 1378353006: Implementation of dwrite font proxy and removal of dwrite font cache (Closed)

Created:
5 years, 2 months ago by Ilya Kulshin
Modified:
4 years, 12 months ago
CC:
chromium-reviews, jam, nasko+codewatch_chromium.org, creis+watch_chromium.org, darin-cc_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Closing this review in favor of the two new reviews. This change uses IPC to communicate with the system font collection in the browser process for font enumeration, bypassing the dwrite font cache. dwrite_font_proxy_message_filter is the browser-side implementation that will handle the IPC messages. dwrite_font_proxy is the renderer-side. Most of the rest is removing of the existing font cache and putting everything together. Feel free to ignore the first 13 patch sets and start at #14. BUG=525142

Patch Set 1 #

Patch Set 2 : Use memory mapped files for loading fonts #

Patch Set 3 : Moving ipc work onto file thread and refactoring renderer init #

Patch Set 4 : Fix spacing #

Patch Set 5 : Fix non-windows build #

Patch Set 6 : #

Patch Set 7 : Merge to recent changes #

Patch Set 8 : Fixing content_browsertests and refactoring file loader registration #

Patch Set 9 : Compile fixes for #8 #

Patch Set 10 : #

Patch Set 11 : #

Patch Set 12 : Removing existing font cache code and some cleanup #

Patch Set 13 : Maybe fix flash? #

Patch Set 14 : Merge to head #

Total comments: 18

Patch Set 15 : Addressing code review feedback #

Patch Set 16 : Rename locals to match style guide #

Total comments: 4

Patch Set 17 : Renaming histograms #

Total comments: 30

Patch Set 18 : More codereview feedback #

Patch Set 19 : More codereview fixes. Jumped the gun on previous patchset. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2530 lines, -1708 lines) Patch
M chrome/browser/chrome_browser_main_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +0 lines, -30 lines 0 comments Download
M chrome/chrome_utility.gypi View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/utility/chrome_content_utility_client.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +0 lines, -2 lines 0 comments Download
D chrome/utility/font_cache_handler_win.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -46 lines 0 comments Download
D chrome/utility/font_cache_handler_win.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -56 lines 0 comments Download
M content/browser/ppapi_plugin_process_host.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +4 lines, -0 lines 0 comments Download
A content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +52 lines, -0 lines 0 comments Download
A content/browser/renderer_host/dwrite_font_proxy_message_filter_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +319 lines, -0 lines 0 comments Download
A content/browser/renderer_host/dwrite_font_proxy_message_filter_win_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +126 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_process_host_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +3 lines, -0 lines 0 comments Download
A content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +30 lines, -0 lines 0 comments Download
A content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +118 lines, -0 lines 0 comments Download
A content/child/dwrite_font_proxy/dwrite_font_proxy_win.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +186 lines, -0 lines 0 comments Download
A content/child/dwrite_font_proxy/dwrite_font_proxy_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +472 lines, -0 lines 0 comments Download
A content/child/dwrite_font_proxy/dwrite_font_proxy_win_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +371 lines, -0 lines 0 comments Download
A content/child/dwrite_font_proxy/dwrite_localized_strings_win.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +54 lines, -0 lines 0 comments Download
A content/child/dwrite_font_proxy/dwrite_localized_strings_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +74 lines, -0 lines 0 comments Download
M content/common/content_message_generator.h View 1 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 0 comments Download
D content/common/dwrite_font_platform_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +0 lines, -1272 lines 0 comments Download
D content/common/dwrite_font_platform_win_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -71 lines 0 comments Download
A content/common/dwrite_font_proxy_messages.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +38 lines, -0 lines 0 comments Download
D content/common/font_warmup_win.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +17 lines, -15 lines 0 comments Download
M content/common/font_warmup_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 5 chunks +47 lines, -137 lines 0 comments Download
M content/common/sandbox_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +0 lines, -17 lines 0 comments Download
M content/content_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +2 lines, -0 lines 0 comments Download
M content/content_child.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +6 lines, -0 lines 0 comments Download
M content/content_common.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +1 line, -2 lines 0 comments Download
M content/content_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 4 chunks +4 lines, -2 lines 0 comments Download
M content/ppapi_plugin/ppapi_plugin_main.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 4 chunks +9 lines, -2 lines 0 comments Download
D content/public/common/dwrite_font_platform_win.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -41 lines 0 comments Download
M content/public/test/render_view_test.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +14 lines, -0 lines 0 comments Download
A content/renderer/dwrite_font_proxy_init_win.cc View 1 2 3 4 5 6 7 8 9 1 chunk +217 lines, -0 lines 0 comments Download
M content/renderer/renderer_main_platform_delegate_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 6 chunks +10 lines, -4 lines 0 comments Download
A content/test/dwrite_font_fake_sender_win.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +135 lines, -0 lines 0 comments Download
A content/test/dwrite_font_fake_sender_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +155 lines, -0 lines 0 comments Download
M content/test/layouttest_support.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +9 lines, -2 lines 0 comments Download
M ipc/ipc_message_start.h View 1 chunk +1 line, -0 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +35 lines, -0 lines 0 comments Download
M ui/gfx/win/direct_write.h View 1 2 3 4 5 2 chunks +5 lines, -0 lines 0 comments Download
M ui/gfx/win/direct_write.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +12 lines, -7 lines 0 comments Download

Messages

Total messages: 26 (10 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1378353006/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1378353006/60001
5 years, 2 months ago (2015-10-15 18:50:06 UTC) #2
commit-bot: I haz the power
Dry run: No L-G-T-M from a valid reviewer yet. Only full committers are accepted. Even ...
5 years, 2 months ago (2015-10-15 18:50:08 UTC) #4
Ilya Kulshin
5 years, 1 month ago (2015-11-02 18:40:57 UTC) #10
Ilya Kulshin
ptal, apologies for the large size.
5 years, 1 month ago (2015-11-02 20:24:38 UTC) #11
jam
did overall scan. since you added multiple reviewers, please specify which files you want them ...
5 years, 1 month ago (2015-11-03 00:18:55 UTC) #12
Ilya Kulshin
Ptal. Fixed naming, let me know if there's something I missed. nasko@ - content/browser/ + ...
5 years, 1 month ago (2015-11-03 18:56:22 UTC) #13
Alexei Svitkine (slow)
https://codereview.chromium.org/1378353006/diff/300001/tools/metrics/histograms/histograms.xml File tools/metrics/histograms/histograms.xml (right): https://codereview.chromium.org/1378353006/diff/300001/tools/metrics/histograms/histograms.xml#newcode8922 tools/metrics/histograms/histograms.xml:8922: +<histogram name="DWriteFontProxy.LoaderType" enum="DWriteFontLoaderType"> There's already a DirectWrite.Fonts. prefix, so ...
5 years, 1 month ago (2015-11-03 19:06:46 UTC) #14
gab
I can't see whether you changed this already (this is CL is SO big!), but ...
5 years, 1 month ago (2015-11-04 18:29:45 UTC) #16
Ilya Kulshin
On 2015/11/04 18:29:45, gab wrote: > I can't see whether you changed this already (this ...
5 years, 1 month ago (2015-11-04 19:03:33 UTC) #18
Ilya Kulshin
https://codereview.chromium.org/1378353006/diff/300001/tools/metrics/histograms/histograms.xml File tools/metrics/histograms/histograms.xml (right): https://codereview.chromium.org/1378353006/diff/300001/tools/metrics/histograms/histograms.xml#newcode8922 tools/metrics/histograms/histograms.xml:8922: +<histogram name="DWriteFontProxy.LoaderType" enum="DWriteFontLoaderType"> On 2015/11/03 19:06:46, Alexei Svitkine (slow) ...
5 years, 1 month ago (2015-11-04 19:04:02 UTC) #19
gab
On 2015/11/04 19:03:33, Ilya Kulshin wrote: > On 2015/11/04 18:29:45, gab wrote: > > I ...
5 years, 1 month ago (2015-11-04 19:29:36 UTC) #20
Ilya Kulshin
Ping, just making sure this doesn't get buried. If you still need more time, that's ...
5 years, 1 month ago (2015-11-06 19:58:14 UTC) #21
nasko
On 2015/11/06 19:58:14, Ilya Kulshin wrote: > Ping, just making sure this doesn't get buried. ...
5 years, 1 month ago (2015-11-06 20:57:42 UTC) #22
Alexei Svitkine (slow)
Suggest following gab@'s suggestion of splitting this up into separate CLs. Meanwhile, here's some random ...
5 years, 1 month ago (2015-11-06 22:11:46 UTC) #23
jam
https://codereview.chromium.org/1378353006/diff/260001/content/browser/renderer_host/dwrite_font_proxy_message_filter_win.cc File content/browser/renderer_host/dwrite_font_proxy_message_filter_win.cc (right): https://codereview.chromium.org/1378353006/diff/260001/content/browser/renderer_host/dwrite_font_proxy_message_filter_win.cc#newcode116 content/browser/renderer_host/dwrite_font_proxy_message_filter_win.cc:116: DWriteFontProxyMsg_FindFamily::WriteReplyParams(reply_message, UINT32_MAX); On 2015/11/03 18:56:21, Ilya Kulshin wrote: > ...
5 years, 1 month ago (2015-11-09 16:32:09 UTC) #24
Ilya Kulshin
5 years, 1 month ago (2015-11-11 01:22:11 UTC) #25
Fixed more comments. Also split this change into two parts:

Issue 1438603002 deals with creating the new classes.
Issue 1432123002 deals with switching to the new code and removing the existing
font cache.

I will start new reviews for these two issues. If you have additional comments,
please comment on those issues instead.

https://codereview.chromium.org/1378353006/diff/320001/content/browser/render...
File content/browser/renderer_host/dwrite_font_proxy_message_filter_win.cc
(right):

https://codereview.chromium.org/1378353006/diff/320001/content/browser/render...
content/browser/renderer_host/dwrite_font_proxy_message_filter_win.cc:81:
BrowserThread::PostTask(
On 2015/11/09 16:32:08, jam wrote:
> I forgot to mention this earlier. no need to have an IPC dispatcher in a class
> that derives from BrowserMessageFilter just for posting a task to another
> thread. just override OverrideThreadForMessage.

Thanks, that works much better.

https://codereview.chromium.org/1378353006/diff/320001/content/browser/render...
content/browser/renderer_host/dwrite_font_proxy_message_filter_win.cc:175:
DCHECK(name[length - 1] == L'\0');
On 2015/11/06 22:11:45, Alexei Svitkine (slow) wrote:
> Can this be a DCHECK_EQ()
> 
> Same for other ones.

Done.

https://codereview.chromium.org/1378353006/diff/320001/content/browser/render...
content/browser/renderer_host/dwrite_font_proxy_message_filter_win.cc:194: const
wchar_t* kFontsToIgnore[] = {
On 2015/11/06 22:11:45, Alexei Svitkine (slow) wrote:
> These should be in an anon namespace at the top of the file.

Done.

https://codereview.chromium.org/1378353006/diff/320001/content/browser/render...
content/browser/renderer_host/dwrite_font_proxy_message_filter_win.cc:337:
UMA_HISTOGRAM_ENUMERATION("DirectWrite.Fonts.Proxy.LoaderType",
On 2015/11/06 22:11:45, Alexei Svitkine (slow) wrote:
> Please make a helper function to log this histogram that takes the enum as a
> param.
> 
> This way, you don't repeat the string name (no chance of typo), but also
because
> each macro expands to a lot of code, so having a function reduces bloat.

Done.

https://codereview.chromium.org/1378353006/diff/320001/content/child/dwrite_f...
File content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.cc (right):

https://codereview.chromium.org/1378353006/diff/320001/content/child/dwrite_f...
content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.cc:24: namespace {
On 2015/11/06 22:11:45, Alexei Svitkine (slow) wrote:
> Nit: Add an empty line below:

Done.

https://codereview.chromium.org/1378353006/diff/320001/content/child/dwrite_f...
File content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h (right):

https://codereview.chromium.org/1378353006/diff/320001/content/child/dwrite_f...
content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h:27: }  // namespace
content
On 2015/11/06 22:11:45, Alexei Svitkine (slow) wrote:
> Nit: Add an empty line above.

Done.

https://codereview.chromium.org/1378353006/diff/320001/content/child/dwrite_f...
File content/child/dwrite_font_proxy/dwrite_font_proxy_win.cc (right):

https://codereview.chromium.org/1378353006/diff/320001/content/child/dwrite_f...
content/child/dwrite_font_proxy/dwrite_font_proxy_win.cc:366:
UMA_HISTOGRAM_ENUMERATION("DirectWrite.Fonts.Proxy.LoadFamily",
On 2015/11/06 22:11:46, Alexei Svitkine (slow) wrote:
> Make a helper function for this histogram.

Done.

https://codereview.chromium.org/1378353006/diff/320001/content/child/dwrite_f...
content/child/dwrite_font_proxy/dwrite_font_proxy_win.cc:392:
DCHECK(family_count <= 1);
On 2015/11/06 22:11:46, Alexei Svitkine (slow) wrote:
> DCHECK_LE

Done.

https://codereview.chromium.org/1378353006/diff/320001/content/child/dwrite_f...
content/child/dwrite_font_proxy/dwrite_font_proxy_win.cc:456: }
On 2015/11/06 22:11:46, Alexei Svitkine (slow) wrote:
> Please add missing empty lines here and below.

Done.

https://codereview.chromium.org/1378353006/diff/320001/content/child/dwrite_f...
content/child/dwrite_font_proxy/dwrite_font_proxy_win.cc:463: void**
fragmentContext) {
On 2015/11/06 22:11:45, Alexei Svitkine (slow) wrote:
> Use hacker_style names. Please fix throughout.

Done.

https://codereview.chromium.org/1378353006/diff/320001/content/child/dwrite_f...
File content/child/dwrite_font_proxy/dwrite_font_proxy_win.h (right):

https://codereview.chromium.org/1378353006/diff/320001/content/child/dwrite_f...
content/child/dwrite_font_proxy/dwrite_font_proxy_win.h:63:
IDWriteFontFileStream** fontFileStream) override;
On 2015/11/06 22:11:46, Alexei Svitkine (slow) wrote:
> Nit: Convention is to put all overridden methods together (with no blank lines
> between them) in a section following a comment of the form:
> 
> // BaseClassName:

Done.

https://codereview.chromium.org/1378353006/diff/320001/content/child/dwrite_f...
content/child/dwrite_font_proxy/dwrite_font_proxy_win.h:84:
base::Callback<IPC::Sender*(void)> sender_;
On 2015/11/06 22:11:46, Alexei Svitkine (slow) wrote:
> DISALLOW_COPY_AND_ASSIGN()
> 
> Please fix throughout.

Added DISALLOW_ASSIGN. DISALLOW_COPY_AND_ASSIGN fails to compile due to use of
Microsoft::WRL::RuntimeClass.

https://codereview.chromium.org/1378353006/diff/320001/content/child/dwrite_f...
File content/child/dwrite_font_proxy/dwrite_font_proxy_win_unittest.cc (right):

https://codereview.chromium.org/1378353006/diff/320001/content/child/dwrite_f...
content/child/dwrite_font_proxy/dwrite_font_proxy_win_unittest.cc:11: #include
"content/child/dwrite_font_proxy/dwrite_font_proxy_win.h"
On 2015/11/06 22:11:46, Alexei Svitkine (slow) wrote:
> This should be the first include

Done.

https://codereview.chromium.org/1378353006/diff/320001/content/child/dwrite_f...
File content/child/dwrite_font_proxy/dwrite_localized_strings_win.cc (right):

https://codereview.chromium.org/1378353006/diff/320001/content/child/dwrite_f...
content/child/dwrite_font_proxy/dwrite_localized_strings_win.cc:52: WCHAR*
stringBuffer,
On 2015/11/06 22:11:46, Alexei Svitkine (slow) wrote:
> hacker_style

Done.

https://codereview.chromium.org/1378353006/diff/320001/content/child/dwrite_f...
content/child/dwrite_font_proxy/dwrite_localized_strings_win.cc:63: if (index >=
strings_.size()) {
On 2015/11/06 22:11:46, Alexei Svitkine (slow) wrote:
> Nit: No {}s

Done.

Powered by Google App Engine
This is Rietveld 408576698