| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
| 6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) | 6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) |
| 7 * Copyright (C) 2011 Google Inc. All rights reserved. | 7 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "core/frame/csp/ContentSecurityPolicy.h" | 45 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 46 #include "core/html/CrossOriginAttribute.h" | 46 #include "core/html/CrossOriginAttribute.h" |
| 47 #include "core/html/LinkManifest.h" | 47 #include "core/html/LinkManifest.h" |
| 48 #include "core/html/imports/LinkImport.h" | 48 #include "core/html/imports/LinkImport.h" |
| 49 #include "core/inspector/ConsoleMessage.h" | 49 #include "core/inspector/ConsoleMessage.h" |
| 50 #include "core/loader/FrameLoader.h" | 50 #include "core/loader/FrameLoader.h" |
| 51 #include "core/loader/FrameLoaderClient.h" | 51 #include "core/loader/FrameLoaderClient.h" |
| 52 #include "core/loader/NetworkHintsInterface.h" | 52 #include "core/loader/NetworkHintsInterface.h" |
| 53 #include "core/style/StyleInheritedData.h" | 53 #include "core/style/StyleInheritedData.h" |
| 54 #include "platform/ContentType.h" | 54 #include "platform/ContentType.h" |
| 55 #include "platform/Histogram.h" |
| 55 #include "platform/MIMETypeRegistry.h" | 56 #include "platform/MIMETypeRegistry.h" |
| 56 #include "platform/RuntimeEnabledFeatures.h" | 57 #include "platform/RuntimeEnabledFeatures.h" |
| 57 #include "public/platform/Platform.h" | |
| 58 #include "wtf/StdLibExtras.h" | 58 #include "wtf/StdLibExtras.h" |
| 59 | 59 |
| 60 namespace blink { | 60 namespace blink { |
| 61 | 61 |
| 62 using namespace HTMLNames; | 62 using namespace HTMLNames; |
| 63 | 63 |
| 64 template <typename CharacterType> | 64 template <typename CharacterType> |
| 65 static void parseSizes(const CharacterType* value, unsigned length, Vector<IntSi
ze>& iconSizes) | 65 static void parseSizes(const CharacterType* value, unsigned length, Vector<IntSi
ze>& iconSizes) |
| 66 { | 66 { |
| 67 enum State { | 67 enum State { |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 removePendingSheet(); | 527 removePendingSheet(); |
| 528 if (m_sheet) | 528 if (m_sheet) |
| 529 clearSheet(); | 529 clearSheet(); |
| 530 return; | 530 return; |
| 531 } | 531 } |
| 532 // Completing the sheet load may cause scripts to execute. | 532 // Completing the sheet load may cause scripts to execute. |
| 533 RefPtrWillBeRawPtr<Node> protector(m_owner.get()); | 533 RefPtrWillBeRawPtr<Node> protector(m_owner.get()); |
| 534 | 534 |
| 535 CSSParserContext parserContext(m_owner->document(), 0, baseURL, charset); | 535 CSSParserContext parserContext(m_owner->document(), 0, baseURL, charset); |
| 536 | 536 |
| 537 DEFINE_STATIC_LOCAL(EnumerationHistogram, restoredCachedStyleSheetHistogram,
("Blink.RestoredCachedStyleSheet", 2)); |
| 538 DEFINE_STATIC_LOCAL(EnumerationHistogram, restoredCachedStyleSheet2Histogram
, ("Blink.RestoredCachedStyleSheet2", StyleSheetCacheStatusCount)); |
| 539 |
| 537 if (RefPtrWillBeRawPtr<StyleSheetContents> restoredSheet = const_cast<CSSSty
leSheetResource*>(cachedStyleSheet)->restoreParsedStyleSheet(parserContext)) { | 540 if (RefPtrWillBeRawPtr<StyleSheetContents> restoredSheet = const_cast<CSSSty
leSheetResource*>(cachedStyleSheet)->restoreParsedStyleSheet(parserContext)) { |
| 538 ASSERT(restoredSheet->isCacheable()); | 541 ASSERT(restoredSheet->isCacheable()); |
| 539 ASSERT(!restoredSheet->isLoading()); | 542 ASSERT(!restoredSheet->isLoading()); |
| 540 | 543 |
| 541 if (m_sheet) | 544 if (m_sheet) |
| 542 clearSheet(); | 545 clearSheet(); |
| 543 m_sheet = CSSStyleSheet::create(restoredSheet, m_owner); | 546 m_sheet = CSSStyleSheet::create(restoredSheet, m_owner); |
| 544 m_sheet->setMediaQueries(MediaQuerySet::create(m_owner->media())); | 547 m_sheet->setMediaQueries(MediaQuerySet::create(m_owner->media())); |
| 545 m_sheet->setTitle(m_owner->title()); | 548 m_sheet->setTitle(m_owner->title()); |
| 546 setCrossOriginStylesheetStatus(m_sheet.get()); | 549 setCrossOriginStylesheetStatus(m_sheet.get()); |
| 547 | 550 |
| 548 m_loading = false; | 551 m_loading = false; |
| 549 restoredSheet->checkLoaded(); | 552 restoredSheet->checkLoaded(); |
| 550 | 553 |
| 551 Platform::current()->histogramEnumeration("Blink.RestoredCachedStyleShee
t", true, 2); | 554 restoredCachedStyleSheetHistogram.count(true); |
| 552 Platform::current()->histogramEnumeration("Blink.RestoredCachedStyleShee
t2", StyleSheetInMemoryCache, StyleSheetCacheStatusCount); | 555 restoredCachedStyleSheet2Histogram.count(StyleSheetInMemoryCache); |
| 553 return; | 556 return; |
| 554 } | 557 } |
| 555 Platform::current()->histogramEnumeration("Blink.RestoredCachedStyleSheet",
false, 2); | 558 restoredCachedStyleSheetHistogram.count(false); |
| 556 StyleSheetCacheStatus cacheStatus = cachedStyleSheet->response().wasCached()
? StyleSheetInDiskCache : StyleSheetNewEntry; | 559 StyleSheetCacheStatus cacheStatus = cachedStyleSheet->response().wasCached()
? StyleSheetInDiskCache : StyleSheetNewEntry; |
| 557 Platform::current()->histogramEnumeration("Blink.RestoredCachedStyleSheet2",
cacheStatus, StyleSheetCacheStatusCount); | 560 restoredCachedStyleSheet2Histogram.count(cacheStatus); |
| 558 | 561 |
| 559 RefPtrWillBeRawPtr<StyleSheetContents> styleSheet = StyleSheetContents::crea
te(href, parserContext); | 562 RefPtrWillBeRawPtr<StyleSheetContents> styleSheet = StyleSheetContents::crea
te(href, parserContext); |
| 560 | 563 |
| 561 if (m_sheet) | 564 if (m_sheet) |
| 562 clearSheet(); | 565 clearSheet(); |
| 563 | 566 |
| 564 m_sheet = CSSStyleSheet::create(styleSheet, m_owner); | 567 m_sheet = CSSStyleSheet::create(styleSheet, m_owner); |
| 565 m_sheet->setMediaQueries(MediaQuerySet::create(m_owner->media())); | 568 m_sheet->setMediaQueries(MediaQuerySet::create(m_owner->media())); |
| 566 m_sheet->setTitle(m_owner->title()); | 569 m_sheet->setTitle(m_owner->title()); |
| 567 setCrossOriginStylesheetStatus(m_sheet.get()); | 570 setCrossOriginStylesheetStatus(m_sheet.get()); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 } | 791 } |
| 789 | 792 |
| 790 DEFINE_TRACE(LinkStyle) | 793 DEFINE_TRACE(LinkStyle) |
| 791 { | 794 { |
| 792 visitor->trace(m_sheet); | 795 visitor->trace(m_sheet); |
| 793 LinkResource::trace(visitor); | 796 LinkResource::trace(visitor); |
| 794 ResourceOwner<StyleSheetResource>::trace(visitor); | 797 ResourceOwner<StyleSheetResource>::trace(visitor); |
| 795 } | 798 } |
| 796 | 799 |
| 797 } // namespace blink | 800 } // namespace blink |
| OLD | NEW |