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

Side by Side Diff: third_party/WebKit/Source/core/css/MediaValuesCached.h

Issue 1679703002: Revert of 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, 10 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MediaValuesCached_h 5 #ifndef MediaValuesCached_h
6 #define MediaValuesCached_h 6 #define MediaValuesCached_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/css/MediaValues.h" 9 #include "core/css/MediaValues.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 class CORE_EXPORT MediaValuesCached final : public MediaValues { 13 class CORE_EXPORT MediaValuesCached final : public MediaValues {
14 public: 14 public:
15 struct MediaValuesCachedData final { 15 struct MediaValuesCachedData {
16 DISALLOW_NEW(); 16 DISALLOW_NEW();
17 // Members variables must be thread safe, since they're copied to the pa rser thread 17 // Members variables must be thread safe, since they're copied to the pa rser thread
18 double viewportWidth; 18 double viewportWidth;
19 double viewportHeight; 19 double viewportHeight;
20 int deviceWidth; 20 int deviceWidth;
21 int deviceHeight; 21 int deviceHeight;
22 float devicePixelRatio; 22 float devicePixelRatio;
23 int colorBitsPerComponent; 23 int colorBitsPerComponent;
24 int monochromeBitsPerComponent; 24 int monochromeBitsPerComponent;
25 PointerType primaryPointerType; 25 PointerType primaryPointerType;
(...skipping 17 matching lines...) Expand all
43 , primaryPointerType(PointerTypeNone) 43 , primaryPointerType(PointerTypeNone)
44 , availablePointerTypes(PointerTypeNone) 44 , availablePointerTypes(PointerTypeNone)
45 , primaryHoverType(HoverTypeNone) 45 , primaryHoverType(HoverTypeNone)
46 , availableHoverTypes(HoverTypeNone) 46 , availableHoverTypes(HoverTypeNone)
47 , defaultFontSize(16) 47 , defaultFontSize(16)
48 , threeDEnabled(false) 48 , threeDEnabled(false)
49 , strictMode(true) 49 , strictMode(true)
50 , displayMode(WebDisplayModeBrowser) 50 , displayMode(WebDisplayModeBrowser)
51 { 51 {
52 } 52 }
53
54 explicit MediaValuesCachedData(Document&);
55
56 MediaValuesCachedData deepCopy() const
57 {
58 MediaValuesCachedData data;
59 data.viewportWidth = viewportWidth;
60 data.viewportHeight = viewportHeight;
61 data.deviceWidth = deviceWidth;
62 data.deviceHeight = deviceHeight;
63 data.devicePixelRatio = devicePixelRatio;
64 data.colorBitsPerComponent = colorBitsPerComponent;
65 data.monochromeBitsPerComponent = monochromeBitsPerComponent;
66 data.primaryPointerType = primaryPointerType;
67 data.availablePointerTypes = availablePointerTypes;
68 data.primaryHoverType = primaryHoverType;
69 data.availableHoverTypes = availableHoverTypes;
70 data.defaultFontSize = defaultFontSize;
71 data.threeDEnabled = threeDEnabled;
72 data.strictMode = strictMode;
73 data.mediaType = mediaType.isolatedCopy();
74 data.displayMode = displayMode;
75 return data;
76 }
77 }; 53 };
78 54
79 static PassRefPtrWillBeRawPtr<MediaValuesCached> create(); 55 static PassRefPtrWillBeRawPtr<MediaValuesCached> create();
80 static PassRefPtrWillBeRawPtr<MediaValuesCached> create(const MediaValuesCac hedData&); 56 static PassRefPtrWillBeRawPtr<MediaValuesCached> create(Document&);
57 static PassRefPtrWillBeRawPtr<MediaValuesCached> create(LocalFrame*);
58 static PassRefPtrWillBeRawPtr<MediaValuesCached> create(MediaValuesCachedDat a&);
81 PassRefPtrWillBeRawPtr<MediaValues> copy() const override; 59 PassRefPtrWillBeRawPtr<MediaValues> copy() const override;
60 bool isSafeToSendToAnotherThread() const;
82 bool computeLength(double value, CSSPrimitiveValue::UnitType, int& result) c onst override; 61 bool computeLength(double value, CSSPrimitiveValue::UnitType, int& result) c onst override;
83 bool computeLength(double value, CSSPrimitiveValue::UnitType, double& result ) const override; 62 bool computeLength(double value, CSSPrimitiveValue::UnitType, double& result ) const override;
84 63
85 double viewportWidth() const override; 64 double viewportWidth() const override;
86 double viewportHeight() const override; 65 double viewportHeight() const override;
87 int deviceWidth() const override; 66 int deviceWidth() const override;
88 int deviceHeight() const override; 67 int deviceHeight() const override;
89 float devicePixelRatio() const override; 68 float devicePixelRatio() const override;
90 int colorBitsPerComponent() const override; 69 int colorBitsPerComponent() const override;
91 int monochromeBitsPerComponent() const override; 70 int monochromeBitsPerComponent() const override;
(...skipping 12 matching lines...) Expand all
104 void setViewportHeight(double); 83 void setViewportHeight(double);
105 84
106 protected: 85 protected:
107 MediaValuesCached(); 86 MediaValuesCached();
108 MediaValuesCached(LocalFrame*); 87 MediaValuesCached(LocalFrame*);
109 MediaValuesCached(const MediaValuesCachedData&); 88 MediaValuesCached(const MediaValuesCachedData&);
110 89
111 MediaValuesCachedData m_data; 90 MediaValuesCachedData m_data;
112 }; 91 };
113 92
114 template<> struct CrossThreadCopierBase<false, false, false, MediaValuesCached:: MediaValuesCachedData> {
115 typedef MediaValuesCached::MediaValuesCachedData Type;
116 static Type copy(const MediaValuesCached::MediaValuesCachedData& data) { ret urn data.deepCopy(); }
117 };
118
119 } // namespace blink 93 } // namespace blink
120 94
121 #endif // MediaValuesCached_h 95 #endif // MediaValuesCached_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/MediaValues.cpp ('k') | third_party/WebKit/Source/core/css/MediaValuesCached.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698