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

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

Issue 1647823003: Add UMA to measure font-display value (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/RemoteFontFaceSource.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "core/dom/DOMArrayBufferView.h" 52 #include "core/dom/DOMArrayBufferView.h"
53 #include "core/dom/DOMException.h" 53 #include "core/dom/DOMException.h"
54 #include "core/dom/Document.h" 54 #include "core/dom/Document.h"
55 #include "core/dom/ExceptionCode.h" 55 #include "core/dom/ExceptionCode.h"
56 #include "core/dom/StyleEngine.h" 56 #include "core/dom/StyleEngine.h"
57 #include "core/frame/LocalFrame.h" 57 #include "core/frame/LocalFrame.h"
58 #include "core/frame/Settings.h" 58 #include "core/frame/Settings.h"
59 #include "core/frame/UseCounter.h" 59 #include "core/frame/UseCounter.h"
60 #include "platform/FontFamilyNames.h" 60 #include "platform/FontFamilyNames.h"
61 #include "platform/SharedBuffer.h" 61 #include "platform/SharedBuffer.h"
62 #include "public/platform/Platform.h"
62 63
63 namespace blink { 64 namespace blink {
64 65
65 static PassRefPtrWillBeRawPtr<CSSValue> parseCSSValue(const Document* document, const String& value, CSSPropertyID propertyID) 66 static PassRefPtrWillBeRawPtr<CSSValue> parseCSSValue(const Document* document, const String& value, CSSPropertyID propertyID)
66 { 67 {
67 CSSParserContext context(*document, UseCounter::getFrom(document)); 68 CSSParserContext context(*document, UseCounter::getFrom(document));
68 return CSSParser::parseFontFaceDescriptor(propertyID, value, context); 69 return CSSParser::parseFontFaceDescriptor(propertyID, value, context);
69 } 70 }
70 71
71 PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, con st AtomicString& family, StringOrArrayBufferOrArrayBufferView& source, const Fon tFaceDescriptors& descriptors) 72 PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, con st AtomicString& family, StringOrArrayBufferOrArrayBufferView& source, const Fon tFaceDescriptors& descriptors)
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 source = adoptPtrWillBeNoop(new RemoteFontFaceSource(fetched , fontLoader, CSSValueToFontDisplay(m_display.get()))); 594 source = adoptPtrWillBeNoop(new RemoteFontFaceSource(fetched , fontLoader, CSSValueToFontDisplay(m_display.get())));
594 } 595 }
595 } 596 }
596 } else { 597 } else {
597 source = adoptPtrWillBeNoop(new LocalFontFaceSource(item->resource() )); 598 source = adoptPtrWillBeNoop(new LocalFontFaceSource(item->resource() ));
598 } 599 }
599 600
600 if (source) 601 if (source)
601 m_cssFontFace->addSource(source.release()); 602 m_cssFontFace->addSource(source.release());
602 } 603 }
604
605 if (m_display)
606 Platform::current()->histogramEnumeration("WebFont.FontDisplayValue", CS SValueToFontDisplay(m_display.get()), FontDisplayEnumMax);
603 } 607 }
604 608
605 void FontFace::initCSSFontFace(const unsigned char* data, size_t size) 609 void FontFace::initCSSFontFace(const unsigned char* data, size_t size)
606 { 610 {
607 m_cssFontFace = createCSSFontFace(this, m_unicodeRange.get()); 611 m_cssFontFace = createCSSFontFace(this, m_unicodeRange.get());
608 if (m_error) 612 if (m_error)
609 return; 613 return;
610 614
611 RefPtr<SharedBuffer> buffer = SharedBuffer::create(data, size); 615 RefPtr<SharedBuffer> buffer = SharedBuffer::create(data, size);
612 OwnPtrWillBeRawPtr<BinaryDataFontFaceSource> source = adoptPtrWillBeNoop(new BinaryDataFontFaceSource(buffer.get(), m_otsParseMessage)); 616 OwnPtrWillBeRawPtr<BinaryDataFontFaceSource> source = adoptPtrWillBeNoop(new BinaryDataFontFaceSource(buffer.get(), m_otsParseMessage));
(...skipping 24 matching lines...) Expand all
637 { 641 {
638 return m_cssFontFace->hadBlankText(); 642 return m_cssFontFace->hadBlankText();
639 } 643 }
640 644
641 bool FontFace::hasPendingActivity() const 645 bool FontFace::hasPendingActivity() const
642 { 646 {
643 return m_status == Loading && executionContext() && !executionContext()->act iveDOMObjectsAreStopped(); 647 return m_status == Loading && executionContext() && !executionContext()->act iveDOMObjectsAreStopped();
644 } 648 }
645 649
646 } // namespace blink 650 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/RemoteFontFaceSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698