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

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

Issue 18882002: [oilpan] Move 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
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 19 matching lines...) Expand all
30 #include "core/css/CSSFontFaceSource.h" 30 #include "core/css/CSSFontFaceSource.h"
31 #include "core/css/CSSFontSelector.h" 31 #include "core/css/CSSFontSelector.h"
32 #include "core/dom/Document.h" 32 #include "core/dom/Document.h"
33 #include "RuntimeEnabledFeatures.h" 33 #include "RuntimeEnabledFeatures.h"
34 #include "core/platform/graphics/FontDescription.h" 34 #include "core/platform/graphics/FontDescription.h"
35 #include "core/platform/graphics/SegmentedFontData.h" 35 #include "core/platform/graphics/SegmentedFontData.h"
36 #include "core/platform/graphics/SimpleFontData.h" 36 #include "core/platform/graphics/SimpleFontData.h"
37 37
38 namespace WebCore { 38 namespace WebCore {
39 39
40 DEFINE_GC_TYPE_MARKER(CSSSegmentedFontFace);
41
40 CSSSegmentedFontFace::CSSSegmentedFontFace(CSSFontSelector* fontSelector) 42 CSSSegmentedFontFace::CSSSegmentedFontFace(CSSFontSelector* fontSelector)
41 : m_fontSelector(fontSelector) 43 : m_fontSelector(fontSelector)
42 { 44 {
43 } 45 }
44 46
45 CSSSegmentedFontFace::~CSSSegmentedFontFace() 47 CSSSegmentedFontFace::~CSSSegmentedFontFace()
46 { 48 {
49 dispose();
50 }
51
52 void CSSSegmentedFontFace::dispose()
53 {
47 pruneTable(); 54 pruneTable();
48 unsigned size = m_fontFaces.size(); 55 unsigned size = m_fontFaces.size();
49 for (unsigned i = 0; i < size; i++) 56 for (unsigned i = 0; i < size; i++)
50 m_fontFaces[i]->removedFromSegmentedFontFace(this); 57 m_fontFaces[i]->removedFromSegmentedFontFace(Handle<CSSSegmentedFontFace >(this));
58 m_fontFaces.clear();
59 m_fontSelector = 0;
51 } 60 }
52 61
53 void CSSSegmentedFontFace::pruneTable() 62 void CSSSegmentedFontFace::pruneTable()
54 { 63 {
55 // Make sure the glyph page tree prunes out all uses of this custom font. 64 // Make sure the glyph page tree prunes out all uses of this custom font.
56 if (m_fontDataTable.isEmpty()) 65 if (m_fontDataTable.isEmpty())
57 return; 66 return;
58 67
59 m_fontDataTable.clear(); 68 m_fontDataTable.clear();
60 } 69 }
(...skipping 11 matching lines...) Expand all
72 81
73 void CSSSegmentedFontFace::fontLoaded(CSSFontFace*) 82 void CSSSegmentedFontFace::fontLoaded(CSSFontFace*)
74 { 83 {
75 pruneTable(); 84 pruneTable();
76 85
77 if (RuntimeEnabledFeatures::fontLoadEventsEnabled() && !isLoading()) { 86 if (RuntimeEnabledFeatures::fontLoadEventsEnabled() && !isLoading()) {
78 Vector<RefPtr<LoadFontCallback> > callbacks; 87 Vector<RefPtr<LoadFontCallback> > callbacks;
79 m_callbacks.swap(callbacks); 88 m_callbacks.swap(callbacks);
80 for (size_t index = 0; index < callbacks.size(); ++index) { 89 for (size_t index = 0; index < callbacks.size(); ++index) {
81 if (checkFont()) 90 if (checkFont())
82 callbacks[index]->notifyLoaded(this); 91 callbacks[index]->notifyLoaded(Handle<CSSSegmentedFontFace>(this ));
83 else 92 else
84 callbacks[index]->notifyError(this); 93 callbacks[index]->notifyError(Handle<CSSSegmentedFontFace>(this) );
85 } 94 }
86 } 95 }
87 } 96 }
88 97
89 void CSSSegmentedFontFace::appendFontFace(PassRefPtr<CSSFontFace> fontFace) 98 void CSSSegmentedFontFace::appendFontFace(PassRefPtr<CSSFontFace> fontFace)
90 { 99 {
91 pruneTable(); 100 pruneTable();
92 fontFace->addedToSegmentedFontFace(this); 101 fontFace->addedToSegmentedFontFace(Handle<CSSSegmentedFontFace>(this));
93 m_fontFaces.append(fontFace); 102 m_fontFaces.append(fontFace);
94 } 103 }
95 104
96 static void appendFontDataWithInvalidUnicodeRangeIfLoading(SegmentedFontData* ne wFontData, PassRefPtr<SimpleFontData> prpFaceFontData, const Vector<CSSFontFace: :UnicodeRange>& ranges) 105 static void appendFontDataWithInvalidUnicodeRangeIfLoading(SegmentedFontData* ne wFontData, PassRefPtr<SimpleFontData> prpFaceFontData, const Vector<CSSFontFace: :UnicodeRange>& ranges)
97 { 106 {
98 RefPtr<SimpleFontData> faceFontData = prpFaceFontData; 107 RefPtr<SimpleFontData> faceFontData = prpFaceFontData;
99 if (faceFontData->isLoading()) { 108 if (faceFontData->isLoading()) {
100 newFontData->appendRange(FontDataRange(0, 0, faceFontData)); 109 newFontData->appendRange(FontDataRange(0, 0, faceFontData));
101 return; 110 return;
102 } 111 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 177 }
169 178
170 void CSSSegmentedFontFace::loadFont(const FontDescription& fontDescription, Pass RefPtr<LoadFontCallback> callback) 179 void CSSSegmentedFontFace::loadFont(const FontDescription& fontDescription, Pass RefPtr<LoadFontCallback> callback)
171 { 180 {
172 getFontData(fontDescription); // Kick off the load. 181 getFontData(fontDescription); // Kick off the load.
173 182
174 if (callback) { 183 if (callback) {
175 if (isLoading()) 184 if (isLoading())
176 m_callbacks.append(callback); 185 m_callbacks.append(callback);
177 else if (checkFont()) 186 else if (checkFont())
178 callback->notifyLoaded(this); 187 callback->notifyLoaded(Handle<CSSSegmentedFontFace>(this));
179 else 188 else
180 callback->notifyError(this); 189 callback->notifyError(Handle<CSSSegmentedFontFace>(this));
181 } 190 }
182 } 191 }
183 192
184 } 193 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698