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

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

Issue 171333003: Pass implementation object to supplemental classes by reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 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 | Annotate | Revision Log
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 private: 112 private:
113 FontsReadyPromiseResolver(ScriptPromise promise, ExecutionContext* context) 113 FontsReadyPromiseResolver(ScriptPromise promise, ExecutionContext* context)
114 : m_scriptState(ScriptState::current()) 114 : m_scriptState(ScriptState::current())
115 , m_resolver(ScriptPromiseResolver::create(promise, context)) 115 , m_resolver(ScriptPromiseResolver::create(promise, context))
116 { } 116 { }
117 ScriptState* m_scriptState; 117 ScriptState* m_scriptState;
118 RefPtr<ScriptPromiseResolver> m_resolver; 118 RefPtr<ScriptPromiseResolver> m_resolver;
119 }; 119 };
120 120
121 FontFaceSet::FontFaceSet(Document* document) 121 FontFaceSet::FontFaceSet(Document& document)
122 : ActiveDOMObject(document) 122 : ActiveDOMObject(&document)
123 , m_loadingCount(0) 123 , m_loadingCount(0)
124 , m_shouldFireLoadingEvent(false) 124 , m_shouldFireLoadingEvent(false)
125 , m_asyncRunner(this, &FontFaceSet::handlePendingEventsAndPromises) 125 , m_asyncRunner(this, &FontFaceSet::handlePendingEventsAndPromises)
126 { 126 {
127 suspendIfNeeded(); 127 suspendIfNeeded();
128 } 128 }
129 129
130 FontFaceSet::~FontFaceSet() 130 FontFaceSet::~FontFaceSet()
131 { 131 {
132 } 132 }
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 return; 521 return;
522 m_recorded = true; 522 m_recorded = true;
523 blink::Platform::current()->histogramCustomCounts("WebFont.WebFontsInPage", m_count, 1, 100, 50); 523 blink::Platform::current()->histogramCustomCounts("WebFont.WebFontsInPage", m_count, 1, 100, 50);
524 } 524 }
525 525
526 static const char* supplementName() 526 static const char* supplementName()
527 { 527 {
528 return "FontFaceSet"; 528 return "FontFaceSet";
529 } 529 }
530 530
531 PassRefPtr<FontFaceSet> FontFaceSet::from(Document* document) 531 PassRefPtr<FontFaceSet> FontFaceSet::from(Document& document)
532 { 532 {
533 RefPtr<FontFaceSet> fonts = static_cast<FontFaceSet*>(SupplementType::from(d ocument, supplementName())); 533 RefPtr<FontFaceSet> fonts = static_cast<FontFaceSet*>(SupplementType::from(d ocument, supplementName()));
534 if (!fonts) { 534 if (!fonts) {
535 fonts = FontFaceSet::create(document); 535 fonts = FontFaceSet::create(document);
536 SupplementType::provideTo(document, supplementName(), fonts); 536 SupplementType::provideTo(document, supplementName(), fonts);
537 } 537 }
538 538
539 return fonts.release(); 539 return fonts.release();
540 } 540 }
541 541
542 void FontFaceSet::didLayout(Document* document) 542 void FontFaceSet::didLayout(Document& document)
543 { 543 {
544 if (FontFaceSet* fonts = static_cast<FontFaceSet*>(SupplementType::from(docu ment, supplementName()))) 544 if (FontFaceSet* fonts = static_cast<FontFaceSet*>(SupplementType::from(docu ment, supplementName())))
545 fonts->didLayout(); 545 fonts->didLayout();
546 } 546 }
547 547
548 548
549 } // namespace WebCore 549 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698