| OLD | NEW | 
|    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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  103 } |  103 } | 
|  104  |  104  | 
|  105 void FontResource::setRevalidatingRequest(const ResourceRequest& request) { |  105 void FontResource::setRevalidatingRequest(const ResourceRequest& request) { | 
|  106   // Reload will use the same object, and needs to reset |m_loadLimitState| |  106   // Reload will use the same object, and needs to reset |m_loadLimitState| | 
|  107   // before any didAddClient() is called again. |  107   // before any didAddClient() is called again. | 
|  108   m_loadLimitState = LoadNotStarted; |  108   m_loadLimitState = LoadNotStarted; | 
|  109   Resource::setRevalidatingRequest(request); |  109   Resource::setRevalidatingRequest(request); | 
|  110 } |  110 } | 
|  111  |  111  | 
|  112 void FontResource::startLoadLimitTimers() { |  112 void FontResource::startLoadLimitTimers() { | 
|  113   DCHECK(isLoading()); |  113   // TODO(toyoshim): Change CHECK() to DCHECK() if this can survive on Canary | 
 |  114   // for some days. http://crbug.com/670638 | 
 |  115   CHECK(isLoading()); | 
|  114   DCHECK_EQ(m_loadLimitState, LoadNotStarted); |  116   DCHECK_EQ(m_loadLimitState, LoadNotStarted); | 
|  115   m_loadLimitState = UnderLimit; |  117   m_loadLimitState = UnderLimit; | 
|  116   m_fontLoadShortLimitTimer.startOneShot(fontLoadWaitShortLimitSec, |  118   m_fontLoadShortLimitTimer.startOneShot(fontLoadWaitShortLimitSec, | 
|  117                                          BLINK_FROM_HERE); |  119                                          BLINK_FROM_HERE); | 
|  118   m_fontLoadLongLimitTimer.startOneShot(fontLoadWaitLongLimitSec, |  120   m_fontLoadLongLimitTimer.startOneShot(fontLoadWaitLongLimitSec, | 
|  119                                         BLINK_FROM_HERE); |  121                                         BLINK_FROM_HERE); | 
|  120 } |  122 } | 
|  121  |  123  | 
|  122 bool FontResource::ensureCustomFontData() { |  124 bool FontResource::ensureCustomFontData() { | 
|  123   if (!m_fontData && !errorOccurred() && !isLoading()) { |  125   if (!m_fontData && !errorOccurred() && !isLoading()) { | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
|  137 FontPlatformData FontResource::platformDataFromCustomData( |  139 FontPlatformData FontResource::platformDataFromCustomData( | 
|  138     float size, |  140     float size, | 
|  139     bool bold, |  141     bool bold, | 
|  140     bool italic, |  142     bool italic, | 
|  141     FontOrientation orientation) { |  143     FontOrientation orientation) { | 
|  142   DCHECK(m_fontData); |  144   DCHECK(m_fontData); | 
|  143   return m_fontData->fontPlatformData(size, bold, italic, orientation); |  145   return m_fontData->fontPlatformData(size, bold, italic, orientation); | 
|  144 } |  146 } | 
|  145  |  147  | 
|  146 void FontResource::fontLoadShortLimitCallback(TimerBase*) { |  148 void FontResource::fontLoadShortLimitCallback(TimerBase*) { | 
 |  149   // TODO(toyoshim): Change CHECK() to DCHECK() and remove if(!isLoading()) if | 
 |  150   // this can survive on Canary for some days. http://crbug.com/670638 | 
 |  151   CHECK(isLoading()); | 
|  147   if (!isLoading()) |  152   if (!isLoading()) | 
|  148     return; |  153     return; | 
|  149   DCHECK_EQ(m_loadLimitState, UnderLimit); |  154   DCHECK_EQ(m_loadLimitState, UnderLimit); | 
|  150   m_loadLimitState = ShortLimitExceeded; |  155   m_loadLimitState = ShortLimitExceeded; | 
|  151   ResourceClientWalker<FontResourceClient> walker(clients()); |  156   ResourceClientWalker<FontResourceClient> walker(clients()); | 
|  152   while (FontResourceClient* client = walker.next()) |  157   while (FontResourceClient* client = walker.next()) | 
|  153     client->fontLoadShortLimitExceeded(this); |  158     client->fontLoadShortLimitExceeded(this); | 
|  154 } |  159 } | 
|  155  |  160  | 
|  156 void FontResource::fontLoadLongLimitCallback(TimerBase*) { |  161 void FontResource::fontLoadLongLimitCallback(TimerBase*) { | 
 |  162   // TODO(toyoshim): Change CHECK() to DCHECK() and remove if(!isLoading()) if | 
 |  163   // this can survive on Canary for some days. http://crbug.com/670638 | 
 |  164   CHECK(isLoading()); | 
|  157   if (!isLoading()) |  165   if (!isLoading()) | 
|  158     return; |  166     return; | 
|  159   DCHECK_EQ(m_loadLimitState, ShortLimitExceeded); |  167   DCHECK_EQ(m_loadLimitState, ShortLimitExceeded); | 
|  160   m_loadLimitState = LongLimitExceeded; |  168   m_loadLimitState = LongLimitExceeded; | 
|  161   ResourceClientWalker<FontResourceClient> walker(clients()); |  169   ResourceClientWalker<FontResourceClient> walker(clients()); | 
|  162   while (FontResourceClient* client = walker.next()) |  170   while (FontResourceClient* client = walker.next()) | 
|  163     client->fontLoadLongLimitExceeded(this); |  171     client->fontLoadLongLimitExceeded(this); | 
|  164 } |  172 } | 
|  165  |  173  | 
|  166 void FontResource::allClientsAndObserversRemoved() { |  174 void FontResource::allClientsAndObserversRemoved() { | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
|  192   Resource::onMemoryDump(level, memoryDump); |  200   Resource::onMemoryDump(level, memoryDump); | 
|  193   if (!m_fontData) |  201   if (!m_fontData) | 
|  194     return; |  202     return; | 
|  195   const String name = getMemoryDumpName() + "/decoded_webfont"; |  203   const String name = getMemoryDumpName() + "/decoded_webfont"; | 
|  196   WebMemoryAllocatorDump* dump = memoryDump->createMemoryAllocatorDump(name); |  204   WebMemoryAllocatorDump* dump = memoryDump->createMemoryAllocatorDump(name); | 
|  197   dump->addScalar("size", "bytes", m_fontData->dataSize()); |  205   dump->addScalar("size", "bytes", m_fontData->dataSize()); | 
|  198   memoryDump->addSuballocation(dump->guid(), "malloc"); |  206   memoryDump->addSuballocation(dump->guid(), "malloc"); | 
|  199 } |  207 } | 
|  200  |  208  | 
|  201 }  // namespace blink |  209 }  // namespace blink | 
| OLD | NEW |