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

Side by Side Diff: third_party/WebKit/Source/core/fetch/FontResource.cpp

Issue 2202173002: Refactoring: Make Resource::m_data private (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address on hiroshige's review Created 4 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Torch Mobile, Inc. 3 * Copyright (C) 2009 Torch Mobile, Inc.
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if (isLoaded() || m_fontLoadLongLimitTimer.isActive()) 114 if (isLoaded() || m_fontLoadLongLimitTimer.isActive())
115 return; 115 return;
116 ASSERT(m_loadLimitState == UnderLimit); 116 ASSERT(m_loadLimitState == UnderLimit);
117 m_fontLoadShortLimitTimer.startOneShot(fontLoadWaitShortLimitSec, BLINK_FROM _HERE); 117 m_fontLoadShortLimitTimer.startOneShot(fontLoadWaitShortLimitSec, BLINK_FROM _HERE);
118 m_fontLoadLongLimitTimer.startOneShot(fontLoadWaitLongLimitSec, BLINK_FROM_H ERE); 118 m_fontLoadLongLimitTimer.startOneShot(fontLoadWaitLongLimitSec, BLINK_FROM_H ERE);
119 } 119 }
120 120
121 bool FontResource::ensureCustomFontData() 121 bool FontResource::ensureCustomFontData()
122 { 122 {
123 if (!m_fontData && !errorOccurred() && !isLoading()) { 123 if (!m_fontData && !errorOccurred() && !isLoading()) {
124 if (m_data) 124 if (data())
125 m_fontData = FontCustomPlatformData::create(m_data.get(), m_otsParsi ngMessage); 125 m_fontData = FontCustomPlatformData::create(data(), m_otsParsingMess age);
126 126
127 if (m_fontData) { 127 if (m_fontData) {
128 recordPackageFormatHistogram(packageFormatOf(m_data.get())); 128 recordPackageFormatHistogram(packageFormatOf(data()));
129 } else { 129 } else {
130 setStatus(DecodeError); 130 setStatus(DecodeError);
131 recordPackageFormatHistogram(PackageFormatUnknown); 131 recordPackageFormatHistogram(PackageFormatUnknown);
132 } 132 }
133 } 133 }
134 return m_fontData.get(); 134 return m_fontData.get();
135 } 135 }
136 136
137 FontPlatformData FontResource::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation) 137 FontPlatformData FontResource::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation)
138 { 138 {
139 ASSERT(m_fontData); 139 ASSERT(m_fontData);
140 return m_fontData->fontPlatformData(size, bold, italic, orientation); 140 return m_fontData->fontPlatformData(size, bold, italic, orientation);
141 } 141 }
142 142
143 bool FontResource::isSafeToUnlock() const 143 bool FontResource::isSafeToUnlock() const
144 { 144 {
145 return m_data->hasOneRef(); 145 return data()->hasOneRef();
146 } 146 }
147 147
148 void FontResource::fontLoadShortLimitCallback(TimerBase*) 148 void FontResource::fontLoadShortLimitCallback(TimerBase*)
149 { 149 {
150 if (!isLoading()) 150 if (!isLoading())
151 return; 151 return;
152 ASSERT(m_loadLimitState == UnderLimit); 152 ASSERT(m_loadLimitState == UnderLimit);
153 m_loadLimitState = ShortLimitExceeded; 153 m_loadLimitState = ShortLimitExceeded;
154 ResourceClientWalker<FontResourceClient> walker(clients()); 154 ResourceClientWalker<FontResourceClient> walker(clients());
155 while (FontResourceClient* client = walker.next()) 155 while (FontResourceClient* client = walker.next())
(...skipping 19 matching lines...) Expand all
175 175
176 void FontResource::checkNotify() 176 void FontResource::checkNotify()
177 { 177 {
178 m_fontLoadShortLimitTimer.stop(); 178 m_fontLoadShortLimitTimer.stop();
179 m_fontLoadLongLimitTimer.stop(); 179 m_fontLoadLongLimitTimer.stop();
180 180
181 Resource::checkNotify(); 181 Resource::checkNotify();
182 } 182 }
183 183
184 } // namespace blink 184 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/DocumentResource.cpp ('k') | third_party/WebKit/Source/core/fetch/ImageResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698