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

Unified Diff: third_party/WebKit/Source/core/css/MediaValuesCached.h

Issue 1641853003: Create MediaValuesCached and TokenPreloadScanner on the parser thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@TRV_MediaValuesCached
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/MediaValuesCached.h
diff --git a/third_party/WebKit/Source/core/css/MediaValuesCached.h b/third_party/WebKit/Source/core/css/MediaValuesCached.h
index 53c6734a7fb23610a3cb4011fc59b33f4709dac5..50b1a5a90588c4bab4f30ea109f0dd703313df13 100644
--- a/third_party/WebKit/Source/core/css/MediaValuesCached.h
+++ b/third_party/WebKit/Source/core/css/MediaValuesCached.h
@@ -12,7 +12,7 @@ namespace blink {
class CORE_EXPORT MediaValuesCached final : public MediaValues {
public:
- struct MediaValuesCachedData {
+ struct MediaValuesCachedData final {
DISALLOW_NEW();
// Members variables must be thread safe, since they're copied to the parser thread
double viewportWidth;
@@ -50,14 +50,35 @@ public:
, displayMode(WebDisplayModeBrowser)
{
}
+
+ explicit MediaValuesCachedData(Document&);
+
+ MediaValuesCachedData deepCopy() const
+ {
+ MediaValuesCachedData data;
+ data.viewportWidth = viewportWidth;
+ data.viewportHeight = viewportHeight;
+ data.deviceWidth = deviceWidth;
+ data.deviceHeight = deviceHeight;
+ data.devicePixelRatio = devicePixelRatio;
+ data.colorBitsPerComponent = colorBitsPerComponent;
+ data.monochromeBitsPerComponent = monochromeBitsPerComponent;
+ data.primaryPointerType = primaryPointerType;
+ data.availablePointerTypes = availablePointerTypes;
+ data.primaryHoverType = primaryHoverType;
+ data.availableHoverTypes = availableHoverTypes;
+ data.defaultFontSize = defaultFontSize;
+ data.threeDEnabled = threeDEnabled;
+ data.strictMode = strictMode;
+ data.mediaType = mediaType.isolatedCopy();
+ data.displayMode = displayMode;
+ return data;
+ }
};
static PassRefPtrWillBeRawPtr<MediaValuesCached> create();
- static PassRefPtrWillBeRawPtr<MediaValuesCached> create(Document&);
- static PassRefPtrWillBeRawPtr<MediaValuesCached> create(LocalFrame*);
- static PassRefPtrWillBeRawPtr<MediaValuesCached> create(MediaValuesCachedData&);
+ static PassRefPtrWillBeRawPtr<MediaValuesCached> create(const MediaValuesCachedData&);
PassRefPtrWillBeRawPtr<MediaValues> copy() 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;
@@ -90,6 +111,11 @@ protected:
MediaValuesCachedData m_data;
};
+template<> struct CrossThreadCopierBase<false, false, false, MediaValuesCached::MediaValuesCachedData> {
Yoav Weiss 2016/02/01 09:29:30 Where is this used? Is it implicitly called somewh
hiroshige 2016/02/01 09:42:10 CrossThreadCopier is called inside threadSafeBind(
+ typedef MediaValuesCached::MediaValuesCachedData Type;
+ static Type copy(const MediaValuesCached::MediaValuesCachedData& data) { return data.deepCopy(); }
+};
+
} // namespace blink
#endif // MediaValuesCached_h

Powered by Google App Engine
This is Rietveld 408576698