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

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

Issue 18375005: [oilpan] Move CSSFontFace and CSSSegmentedFontFace to the managed heap (Closed) Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Created 7 years, 5 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
« no previous file with comments | « Source/core/css/CSSFontSelector.h ('k') | Source/core/css/CSSSegmentedFontFace.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) 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 // We have a face. Ask it for a font data. If it cannot produce one, it will fail, and the OS will take over. 500 // We have a face. Ask it for a font data. If it cannot produce one, it will fail, and the OS will take over.
501 return face->getFontData(fontDescription); 501 return face->getFontData(fontDescription);
502 } 502 }
503 503
504 CSSSegmentedFontFace* CSSFontSelector::getFontFace(const FontDescription& fontDe scription, const AtomicString& family) 504 CSSSegmentedFontFace* CSSFontSelector::getFontFace(const FontDescription& fontDe scription, const AtomicString& family)
505 { 505 {
506 Vector<RefPtr<CSSFontFace> >* familyFontFaces = m_fontFaces.get(family); 506 Vector<RefPtr<CSSFontFace> >* familyFontFaces = m_fontFaces.get(family);
507 if (!familyFontFaces || familyFontFaces->isEmpty()) 507 if (!familyFontFaces || familyFontFaces->isEmpty())
508 return 0; 508 return 0;
509 509
510 OwnPtr<HashMap<unsigned, RefPtr<CSSSegmentedFontFace> > >& segmentedFontFace Cache = m_fonts.add(family, nullptr).iterator->value; 510 OwnPtr<HashMap<unsigned, Persistent<CSSSegmentedFontFace> > >& segmentedFont FaceCache = m_fonts.add(family, nullptr).iterator->value;
511 if (!segmentedFontFaceCache) 511 if (!segmentedFontFaceCache)
512 segmentedFontFaceCache = adoptPtr(new HashMap<unsigned, RefPtr<CSSSegmen tedFontFace> >); 512 segmentedFontFaceCache = adoptPtr(new HashMap<unsigned, Persistent<CSSSe gmentedFontFace> >);
513 513
514 FontTraitsMask traitsMask = fontDescription.traitsMask(); 514 FontTraitsMask traitsMask = fontDescription.traitsMask();
515 515
516 RefPtr<CSSSegmentedFontFace>& face = segmentedFontFaceCache->add(traitsMask, 0).iterator->value; 516 Persistent<CSSSegmentedFontFace>& face = segmentedFontFaceCache->add(traitsM ask, nullptr).iterator->value;
517 if (!face) { 517 if (!face) {
518 face = CSSSegmentedFontFace::create(this); 518 face = CSSSegmentedFontFace::create(this);
519 519
520 // Collect all matching faces and sort them in order of preference. 520 // Collect all matching faces and sort them in order of preference.
521 Vector<CSSFontFace*, 32> candidateFontFaces; 521 Vector<CSSFontFace*, 32> candidateFontFaces;
522 for (int i = familyFontFaces->size() - 1; i >= 0; --i) { 522 for (int i = familyFontFaces->size() - 1; i >= 0; --i) {
523 CSSFontFace* candidate = familyFontFaces->at(i).get(); 523 CSSFontFace* candidate = familyFontFaces->at(i).get();
524 unsigned candidateTraitsMask = candidate->traitsMask(); 524 unsigned candidateTraitsMask = candidate->traitsMask();
525 if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask & Fo ntStyleNormalMask)) 525 if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask & Fo ntStyleNormalMask))
526 continue; 526 continue;
(...skipping 20 matching lines...) Expand all
547 candidateFontFaces.append(candidate); 547 candidateFontFaces.append(candidate);
548 } 548 }
549 } 549 }
550 550
551 desiredTraitsMaskForComparison = traitsMask; 551 desiredTraitsMaskForComparison = traitsMask;
552 stable_sort(candidateFontFaces.begin(), candidateFontFaces.end(), compar eFontFaces); 552 stable_sort(candidateFontFaces.begin(), candidateFontFaces.end(), compar eFontFaces);
553 unsigned numCandidates = candidateFontFaces.size(); 553 unsigned numCandidates = candidateFontFaces.size();
554 for (unsigned i = 0; i < numCandidates; ++i) 554 for (unsigned i = 0; i < numCandidates; ++i)
555 face->appendFontFace(candidateFontFaces[i]); 555 face->appendFontFace(candidateFontFaces[i]);
556 } 556 }
557 return face.get(); 557 return face.raw();
558 } 558 }
559 559
560 void CSSFontSelector::clearDocument() 560 void CSSFontSelector::clearDocument()
561 { 561 {
562 if (!m_document) { 562 if (!m_document) {
563 ASSERT(!m_beginLoadingTimer.isActive()); 563 ASSERT(!m_beginLoadingTimer.isActive());
564 ASSERT(m_fontsToBeginLoading.isEmpty()); 564 ASSERT(m_fontsToBeginLoading.isEmpty());
565 return; 565 return;
566 } 566 }
567 567
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 } 607 }
608 // Ensure that if the request count reaches zero, the frame loader will know about it. 608 // Ensure that if the request count reaches zero, the frame loader will know about it.
609 cachedResourceLoader->loadDone(0); 609 cachedResourceLoader->loadDone(0);
610 // New font loads may be triggered by layout after the document load is comp lete but before we have dispatched 610 // New font loads may be triggered by layout after the document load is comp lete but before we have dispatched
611 // didFinishLoading for the frame. Make sure the delegate is always dispatch ed by checking explicitly. 611 // didFinishLoading for the frame. Make sure the delegate is always dispatch ed by checking explicitly.
612 if (m_document && m_document->frame()) 612 if (m_document && m_document->frame())
613 m_document->frame()->loader()->checkLoadComplete(); 613 m_document->frame()->loader()->checkLoadComplete();
614 } 614 }
615 615
616 } 616 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSFontSelector.h ('k') | Source/core/css/CSSSegmentedFontFace.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698