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

Side by Side Diff: third_party/WebKit/Source/core/css/FontFaceSet.cpp

Issue 1773633003: [DO NOT COMMIT] Trace events for layout-based First Meaningful Paint detection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 are met: 5 * modification, are permitted provided that the following conditions are met:
6 * 6 *
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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 removeFromLoadingFonts(fontFace); 225 removeFromLoadingFonts(fontFace);
226 } 226 }
227 227
228 void FontFaceSet::loadError(FontFace* fontFace) 228 void FontFaceSet::loadError(FontFace* fontFace)
229 { 229 {
230 m_histogram.updateStatus(fontFace); 230 m_histogram.updateStatus(fontFace);
231 m_failedFonts.append(fontFace); 231 m_failedFonts.append(fontFace);
232 removeFromLoadingFonts(fontFace); 232 removeFromLoadingFonts(fontFace);
233 } 233 }
234 234
235 bool FontFaceSet::hasBlankText() const
236 {
237 for (auto& fontFace : m_loadingFonts) {
238 if (fontFace->isBlank())
239 return true;
240 }
241 return false;
242 }
243
235 void FontFaceSet::addToLoadingFonts(FontFace* fontFace) 244 void FontFaceSet::addToLoadingFonts(FontFace* fontFace)
236 { 245 {
237 if (!m_isLoading) { 246 if (!m_isLoading) {
238 m_isLoading = true; 247 m_isLoading = true;
239 m_shouldFireLoadingEvent = true; 248 m_shouldFireLoadingEvent = true;
240 if (m_ready->getState() != ReadyProperty::Pending) 249 if (m_ready->getState() != ReadyProperty::Pending)
241 m_ready->reset(); 250 m_ready->reset();
242 handlePendingEventsAndPromisesSoon(); 251 handlePendingEventsAndPromisesSoon();
243 } 252 }
244 m_loadingFonts.add(fontFace); 253 m_loadingFonts.add(fontFace);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 510
502 return fonts; 511 return fonts;
503 } 512 }
504 513
505 void FontFaceSet::didLayout(Document& document) 514 void FontFaceSet::didLayout(Document& document)
506 { 515 {
507 if (FontFaceSet* fonts = static_cast<FontFaceSet*>(Supplement<Document>::fro m(document, supplementName()))) 516 if (FontFaceSet* fonts = static_cast<FontFaceSet*>(Supplement<Document>::fro m(document, supplementName())))
508 fonts->didLayout(); 517 fonts->didLayout();
509 } 518 }
510 519
520 bool FontFaceSet::hasBlankText(Document& document)
521 {
522 if (FontFaceSet* fonts = static_cast<FontFaceSet*>(Supplement<Document>::fro m(document, supplementName())))
523 return fonts->hasBlankText();
524 return false;
525 }
526
511 FontFaceSetIterable::IterationSource* FontFaceSet::startIteration(ScriptState*, ExceptionState&) 527 FontFaceSetIterable::IterationSource* FontFaceSet::startIteration(ScriptState*, ExceptionState&)
512 { 528 {
513 // Setlike should iterate each item in insertion order, and items should 529 // Setlike should iterate each item in insertion order, and items should
514 // be keep on up to date. But since blink does not have a way to hook up CSS 530 // be keep on up to date. But since blink does not have a way to hook up CSS
515 // modification, take a snapshot here, and make it ordered as follows. 531 // modification, take a snapshot here, and make it ordered as follows.
516 HeapVector<Member<FontFace>> fontFaces; 532 HeapVector<Member<FontFace>> fontFaces;
517 if (inActiveDocumentContext()) { 533 if (inActiveDocumentContext()) {
518 const HeapListHashSet<Member<FontFace>>& cssConnectedFaces = cssConnecte dFontFaceList(); 534 const HeapListHashSet<Member<FontFace>>& cssConnectedFaces = cssConnecte dFontFaceList();
519 fontFaces.reserveInitialCapacity(cssConnectedFaces.size() + m_nonCSSConn ectedFaces.size()); 535 fontFaces.reserveInitialCapacity(cssConnectedFaces.size() + m_nonCSSConn ectedFaces.size());
520 for (const auto& fontFace : cssConnectedFaces) 536 for (const auto& fontFace : cssConnectedFaces)
(...skipping 19 matching lines...) Expand all
540 visitor->trace(m_loadedFonts); 556 visitor->trace(m_loadedFonts);
541 visitor->trace(m_failedFonts); 557 visitor->trace(m_failedFonts);
542 visitor->trace(m_nonCSSConnectedFaces); 558 visitor->trace(m_nonCSSConnectedFaces);
543 visitor->trace(m_asyncRunner); 559 visitor->trace(m_asyncRunner);
544 EventTargetWithInlineData::trace(visitor); 560 EventTargetWithInlineData::trace(visitor);
545 Supplement<Document>::trace(visitor); 561 Supplement<Document>::trace(visitor);
546 ActiveDOMObject::trace(visitor); 562 ActiveDOMObject::trace(visitor);
547 } 563 }
548 564
549 } // namespace blink 565 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698