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

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

Issue 2583093002: Reduce SuspendableObjects (Closed)
Patch Set: Created 4 years 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 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 CSSPropertyFontFeatureSettings) && 147 CSSPropertyFontFeatureSettings) &&
148 fontFace->setPropertyFromStyle(properties, CSSPropertyFontDisplay) && 148 fontFace->setPropertyFromStyle(properties, CSSPropertyFontDisplay) &&
149 !fontFace->family().isEmpty() && fontFace->traits().bitfield()) { 149 !fontFace->family().isEmpty() && fontFace->traits().bitfield()) {
150 fontFace->initCSSFontFace(document, src); 150 fontFace->initCSSFontFace(document, src);
151 return fontFace; 151 return fontFace;
152 } 152 }
153 return nullptr; 153 return nullptr;
154 } 154 }
155 155
156 FontFace::FontFace(ExecutionContext* context) 156 FontFace::FontFace(ExecutionContext* context)
157 : SuspendableObject(context), m_status(Unloaded) { 157 : ContextLifecycleObserver(context), m_status(Unloaded) {}
158 suspendIfNeeded();
159 }
160 158
161 FontFace::FontFace(ExecutionContext* context, 159 FontFace::FontFace(ExecutionContext* context,
162 const AtomicString& family, 160 const AtomicString& family,
163 const FontFaceDescriptors& descriptors) 161 const FontFaceDescriptors& descriptors)
164 : SuspendableObject(context), m_family(family), m_status(Unloaded) { 162 : ContextLifecycleObserver(context), m_family(family), m_status(Unloaded) {
165 Document* document = toDocument(context); 163 Document* document = toDocument(context);
166 setPropertyFromString(document, descriptors.style(), CSSPropertyFontStyle); 164 setPropertyFromString(document, descriptors.style(), CSSPropertyFontStyle);
167 setPropertyFromString(document, descriptors.weight(), CSSPropertyFontWeight); 165 setPropertyFromString(document, descriptors.weight(), CSSPropertyFontWeight);
168 setPropertyFromString(document, descriptors.stretch(), 166 setPropertyFromString(document, descriptors.stretch(),
169 CSSPropertyFontStretch); 167 CSSPropertyFontStretch);
170 setPropertyFromString(document, descriptors.unicodeRange(), 168 setPropertyFromString(document, descriptors.unicodeRange(),
171 CSSPropertyUnicodeRange); 169 CSSPropertyUnicodeRange);
172 setPropertyFromString(document, descriptors.variant(), 170 setPropertyFromString(document, descriptors.variant(),
173 CSSPropertyFontVariant); 171 CSSPropertyFontVariant);
174 setPropertyFromString(document, descriptors.featureSettings(), 172 setPropertyFromString(document, descriptors.featureSettings(),
175 CSSPropertyFontFeatureSettings); 173 CSSPropertyFontFeatureSettings);
176
177 suspendIfNeeded();
178 } 174 }
179 175
180 FontFace::~FontFace() {} 176 FontFace::~FontFace() {}
181 177
182 String FontFace::style() const { 178 String FontFace::style() const {
183 return m_style ? m_style->cssText() : "normal"; 179 return m_style ? m_style->cssText() : "normal";
184 } 180 }
185 181
186 String FontFace::weight() const { 182 String FontFace::weight() const {
187 return m_weight ? m_weight->cssText() : "normal"; 183 return m_weight ? m_weight->cssText() : "normal";
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 visitor->trace(m_weight); 628 visitor->trace(m_weight);
633 visitor->trace(m_stretch); 629 visitor->trace(m_stretch);
634 visitor->trace(m_unicodeRange); 630 visitor->trace(m_unicodeRange);
635 visitor->trace(m_variant); 631 visitor->trace(m_variant);
636 visitor->trace(m_featureSettings); 632 visitor->trace(m_featureSettings);
637 visitor->trace(m_display); 633 visitor->trace(m_display);
638 visitor->trace(m_error); 634 visitor->trace(m_error);
639 visitor->trace(m_loadedProperty); 635 visitor->trace(m_loadedProperty);
640 visitor->trace(m_cssFontFace); 636 visitor->trace(m_cssFontFace);
641 visitor->trace(m_callbacks); 637 visitor->trace(m_callbacks);
642 SuspendableObject::trace(visitor); 638 ContextLifecycleObserver::trace(visitor);
643 } 639 }
644 640
645 bool FontFace::hadBlankText() const { 641 bool FontFace::hadBlankText() const {
646 return m_cssFontFace->hadBlankText(); 642 return m_cssFontFace->hadBlankText();
647 } 643 }
648 644
649 bool FontFace::hasPendingActivity() const { 645 bool FontFace::hasPendingActivity() const {
650 return m_status == Loading && getExecutionContext(); 646 return m_status == Loading && getExecutionContext();
651 } 647 }
652 648
653 } // namespace blink 649 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/FontFace.h ('k') | third_party/WebKit/Source/core/css/MediaQueryList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698