diff options
8 files changed, 20 insertions, 33 deletions
diff --git a/third_party/WebKit/Source/core/css/MediaValues.h b/third_party/WebKit/Source/core/css/MediaValues.h index b8adc37..498d41ef 100644 --- a/third_party/WebKit/Source/core/css/MediaValues.h +++ b/third_party/WebKit/Source/core/css/MediaValues.h @@ -26,7 +26,6 @@ public: static PassRefPtrWillBeRawPtr<MediaValues> createDynamicIfFrameExists(LocalFrame*); virtual PassRefPtrWillBeRawPtr<MediaValues> copy() const = 0; - virtual bool isSafeToSendToAnotherThread() const = 0; static bool computeLengthImpl(double value, CSSPrimitiveValue::UnitType, unsigned defaultFontSize, double viewportWidth, double viewportHeight, double& result); template<typename T> @@ -59,8 +58,6 @@ public: virtual Document* document() const = 0; virtual bool hasValues() const = 0; - virtual bool isCached() const { return false; } - protected: double calculateViewportWidth(LocalFrame*) const; double calculateViewportHeight(LocalFrame*) const; diff --git a/third_party/WebKit/Source/core/css/MediaValuesCached.cpp b/third_party/WebKit/Source/core/css/MediaValuesCached.cpp index e5736597..3fd8c56 100644 --- a/third_party/WebKit/Source/core/css/MediaValuesCached.cpp +++ b/third_party/WebKit/Source/core/css/MediaValuesCached.cpp @@ -11,22 +11,22 @@ namespace blink { -PassRefPtrWillBeRawPtr<MediaValues> MediaValuesCached::create() +PassRefPtrWillBeRawPtr<MediaValuesCached> MediaValuesCached::create() { return adoptRefWillBeNoop(new MediaValuesCached()); } -PassRefPtrWillBeRawPtr<MediaValues> MediaValuesCached::create(MediaValuesCachedData& data) +PassRefPtrWillBeRawPtr<MediaValuesCached> MediaValuesCached::create(MediaValuesCachedData& data) { return adoptRefWillBeNoop(new MediaValuesCached(data)); } -PassRefPtrWillBeRawPtr<MediaValues> MediaValuesCached::create(Document& document) +PassRefPtrWillBeRawPtr<MediaValuesCached> MediaValuesCached::create(Document& document) { return MediaValuesCached::create(frameFrom(document)); } -PassRefPtrWillBeRawPtr<MediaValues> MediaValuesCached::create(LocalFrame* frame) +PassRefPtrWillBeRawPtr<MediaValuesCached> MediaValuesCached::create(LocalFrame* frame) { // FIXME - Added an assert here so we can better understand when a frame is present without its view(). ASSERT(!frame || frame->view()); diff --git a/third_party/WebKit/Source/core/css/MediaValuesCached.h b/third_party/WebKit/Source/core/css/MediaValuesCached.h index dd6591e..53c6734 100644 --- a/third_party/WebKit/Source/core/css/MediaValuesCached.h +++ b/third_party/WebKit/Source/core/css/MediaValuesCached.h @@ -52,12 +52,12 @@ public: } }; - static PassRefPtrWillBeRawPtr<MediaValues> create(); - static PassRefPtrWillBeRawPtr<MediaValues> create(Document&); - static PassRefPtrWillBeRawPtr<MediaValues> create(LocalFrame*); - static PassRefPtrWillBeRawPtr<MediaValues> create(MediaValuesCachedData&); + static PassRefPtrWillBeRawPtr<MediaValuesCached> create(); + static PassRefPtrWillBeRawPtr<MediaValuesCached> create(Document&); + static PassRefPtrWillBeRawPtr<MediaValuesCached> create(LocalFrame*); + static PassRefPtrWillBeRawPtr<MediaValuesCached> create(MediaValuesCachedData&); PassRefPtrWillBeRawPtr<MediaValues> copy() const override; - bool isSafeToSendToAnotherThread() const override; + bool isSafeToSendToAnotherThread() const; bool computeLength(double value, CSSPrimitiveValue::UnitType, int& result) const override; bool computeLength(double value, CSSPrimitiveValue::UnitType, double& result) const override; @@ -82,7 +82,6 @@ public: void setViewportWidth(double); void setViewportHeight(double); - bool isCached() const override { return true; } protected: MediaValuesCached(); MediaValuesCached(LocalFrame*); diff --git a/third_party/WebKit/Source/core/css/MediaValuesDynamic.cpp b/third_party/WebKit/Source/core/css/MediaValuesDynamic.cpp index 2194d31..468cf55 100644 --- a/third_party/WebKit/Source/core/css/MediaValuesDynamic.cpp +++ b/third_party/WebKit/Source/core/css/MediaValuesDynamic.cpp @@ -56,11 +56,6 @@ bool MediaValuesDynamic::computeLength(double value, CSSPrimitiveValue::UnitType result); } -bool MediaValuesDynamic::isSafeToSendToAnotherThread() const -{ - return false; -} - double MediaValuesDynamic::viewportWidth() const { return calculateViewportWidth(m_frame); diff --git a/third_party/WebKit/Source/core/css/MediaValuesDynamic.h b/third_party/WebKit/Source/core/css/MediaValuesDynamic.h index c5606a1..b45df1e 100644 --- a/third_party/WebKit/Source/core/css/MediaValuesDynamic.h +++ b/third_party/WebKit/Source/core/css/MediaValuesDynamic.h @@ -16,7 +16,6 @@ public: static PassRefPtrWillBeRawPtr<MediaValues> create(Document&); static PassRefPtrWillBeRawPtr<MediaValues> create(LocalFrame*); PassRefPtrWillBeRawPtr<MediaValues> copy() const override; - bool isSafeToSendToAnotherThread() const override; bool computeLength(double value, CSSPrimitiveValue::UnitType, int& result) const override; bool computeLength(double value, CSSPrimitiveValue::UnitType, double& result) const override; diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp index 86380b8..ddc46de 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp @@ -105,7 +105,7 @@ static String initiatorFor(const StringImpl* tagImpl) return emptyString(); } -static bool mediaAttributeMatches(const MediaValues& mediaValues, const String& attributeValue) +static bool mediaAttributeMatches(const MediaValuesCached& mediaValues, const String& attributeValue) { RefPtrWillBeRawPtr<MediaQuerySet> mediaQueries = MediaQuerySet::createOffMainThread(attributeValue); MediaQueryEvaluator mediaQueryEvaluator(mediaValues); @@ -115,7 +115,7 @@ static bool mediaAttributeMatches(const MediaValues& mediaValues, const String& class TokenPreloadScanner::StartTagScanner { STACK_ALLOCATED(); public: - StartTagScanner(const StringImpl* tagImpl, PassRefPtrWillBeRawPtr<MediaValues> mediaValues) + StartTagScanner(const StringImpl* tagImpl, PassRefPtrWillBeRawPtr<MediaValuesCached> mediaValues) : m_tagImpl(tagImpl) , m_linkIsStyleSheet(false) , m_linkTypeIsMissingOrSupportedStyleSheet(true) @@ -132,7 +132,6 @@ public: , m_referrerPolicySet(false) , m_referrerPolicy(ReferrerPolicyDefault) { - ASSERT(m_mediaValues->isCached()); if (match(m_tagImpl, imgTag) || match(m_tagImpl, sourceTag)) { m_sourceSize = SizesAttributeParser(m_mediaValues, String()).length(); @@ -437,7 +436,7 @@ private: bool m_sourceSizeSet; FetchRequest::DeferOption m_defer; CrossOriginAttributeValue m_crossOrigin; - RefPtrWillBeMember<MediaValues> m_mediaValues; + RefPtrWillBeMember<MediaValuesCached> m_mediaValues; bool m_referrerPolicySet; ReferrerPolicy m_referrerPolicy; IntegrityMetadataSet m_integrityMetadata; @@ -454,7 +453,6 @@ TokenPreloadScanner::TokenPreloadScanner(const KURL& documentURL, PassOwnPtr<Cac { ASSERT(m_documentParameters.get()); ASSERT(m_documentParameters->mediaValues.get()); - ASSERT(m_documentParameters->mediaValues->isCached()); } TokenPreloadScanner::~TokenPreloadScanner() @@ -499,9 +497,8 @@ static void handleMetaViewport(const String& attributeValue, CachedDocumentParam HTMLMetaElement::getViewportDescriptionFromContentAttribute(attributeValue, description, nullptr, documentParameters->viewportMetaZeroValuesQuirk); FloatSize initialViewport(documentParameters->mediaValues->deviceWidth(), documentParameters->mediaValues->deviceHeight()); PageScaleConstraints constraints = description.resolve(initialViewport, documentParameters->defaultViewportMinWidth); - MediaValuesCached* cachedMediaValues = static_cast<MediaValuesCached*>(documentParameters->mediaValues.get()); - cachedMediaValues->setViewportHeight(constraints.layoutSize.height()); - cachedMediaValues->setViewportWidth(constraints.layoutSize.width()); + documentParameters->mediaValues->setViewportHeight(constraints.layoutSize.height()); + documentParameters->mediaValues->setViewportWidth(constraints.layoutSize.width()); } static void handleMetaReferrer(const String& attributeValue, CachedDocumentParameters* documentParameters, CSSPreloadScanner* cssScanner) @@ -681,7 +678,7 @@ void HTMLPreloadScanner::scan(ResourcePreloader* preloader, const KURL& starting preloader->takeAndPreload(requests); } -CachedDocumentParameters::CachedDocumentParameters(Document* document, PassRefPtrWillBeRawPtr<MediaValues> givenMediaValues) +CachedDocumentParameters::CachedDocumentParameters(Document* document, PassRefPtrWillBeRawPtr<MediaValuesCached> givenMediaValues) { ASSERT(isMainThread()); ASSERT(document); diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.h b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.h index aa11faa..a583d02 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.h @@ -28,7 +28,7 @@ #define HTMLPreloadScanner_h #include "core/CoreExport.h" -#include "core/css/MediaValues.h" +#include "core/css/MediaValuesCached.h" #include "core/dom/ViewportDescription.h" #include "core/html/parser/CSSPreloadScanner.h" #include "core/html/parser/CompactHTMLToken.h" @@ -48,20 +48,20 @@ class SegmentedString; struct CORE_EXPORT CachedDocumentParameters { USING_FAST_MALLOC(CachedDocumentParameters); public: - static PassOwnPtr<CachedDocumentParameters> create(Document* document, PassRefPtrWillBeRawPtr<MediaValues> mediaValues = nullptr) + static PassOwnPtr<CachedDocumentParameters> create(Document* document, PassRefPtrWillBeRawPtr<MediaValuesCached> mediaValues = nullptr) { return adoptPtr(new CachedDocumentParameters(document, mediaValues)); } bool doHtmlPreloadScanning; - RefPtrWillBeCrossThreadPersistent<MediaValues> mediaValues; + RefPtrWillBeCrossThreadPersistent<MediaValuesCached> mediaValues; Length defaultViewportMinWidth; bool viewportMetaZeroValuesQuirk; bool viewportMetaEnabled; ReferrerPolicy referrerPolicy; private: - CachedDocumentParameters(Document*, PassRefPtrWillBeRawPtr<MediaValues>); + CachedDocumentParameters(Document*, PassRefPtrWillBeRawPtr<MediaValuesCached>); }; class TokenPreloadScanner { diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp index bb4e23a..6e6874b 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp @@ -104,7 +104,7 @@ protected: { } - PassRefPtrWillBeRawPtr<MediaValues> createMediaValues() + PassRefPtrWillBeRawPtr<MediaValuesCached> createMediaValues() { MediaValuesCached::MediaValuesCachedData data; data.viewportWidth = 500; |