Add Web API Statistics Collection
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-09-11  Woodrow Wang  <woodrow_wang@apple.com>
2
3         Add Web API Statistics Collection
4         https://bugs.webkit.org/show_bug.cgi?id=187773
5         <rdar://problem/44155162>
6
7         Reviewed by Brent Fulgham.
8
9         Added data collection for web API statistics, specifically regarding the canvas, font loads, 
10         screen functions, and navigator functions. The data collection code is placed under a runtime 
11         enabled feature flag. The statistics are stored in a ResourceLoadStatistics object and written 
12         to a plist on disk. Added a new file CanvasActivityRecord.h and CanvasActivityRecord.cpp which
13         includes a struct to keep track of HTML5 canvas element read and writes. 
14
15         Tests: http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html
16                http/tests/webAPIStatistics/font-load-data-collection.html
17                http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html
18                http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html
19
20         * Sources.txt:
21         * WebCore.xcodeproj/project.pbxproj:
22         * css/CSSFontFaceSource.cpp:
23         (WebCore::CSSFontFaceSource::load):
24         * css/CSSFontSelector.cpp:
25         (WebCore::CSSFontSelector::fontRangesForFamily):
26         (WebCore::CSSFontSelector::fallbackFontAt):
27
28         The following are the functions where we'd like to record a canvas read.
29
30         * html/HTMLCanvasElement.cpp:
31         (WebCore::HTMLCanvasElement::toDataURL):
32         (WebCore::HTMLCanvasElement::toBlob):
33         (WebCore::HTMLCanvasElement::getImageData):
34         (WebCore::HTMLCanvasElement::toMediaSample):
35         (WebCore::HTMLCanvasElement::captureStream):
36
37         The following are the functions where we'd like to record a canvas write.
38
39         * html/canvas/CanvasRenderingContext2D.cpp:
40         (WebCore::CanvasRenderingContext2D::measureText):
41         (WebCore::CanvasRenderingContext2D::drawTextInternal):
42
43         The following files and functions handle the CanvasActivityRecord struct and
44         its respective functions.
45
46         * loader/CanvasActivityRecord.cpp: Added.
47         (WebCore::CanvasActivityRecord::recordWrittenOrMeasuredText):
48         (WebCore::CanvasActivityRecord::mergeWith):
49         * loader/CanvasActivityRecord.h: Added.
50         (WebCore::CanvasActivityRecord::encode const):
51         (WebCore::CanvasActivityRecord::decode):
52
53         * loader/DocumentThreadableLoader.cpp:
54         * loader/FrameLoader.cpp:
55         * loader/ResourceLoadObserver.cpp:
56         (WebCore::ResourceLoadObserver::logFontLoad):
57         (WebCore::ResourceLoadObserver::logCanvasRead):
58         (WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure):
59         (WebCore::ResourceLoadObserver::logNavigatorAPIAccessed):
60         (WebCore::ResourceLoadObserver::logScreenAPIAccessed):
61
62         Before, entries in the ResourceLoadStatistics involving HashSets used "origin" as the key. 
63         Now the encodeHashSet function has been generalized to take any key to encode the entries 
64         in the HashSet. Also added functionality to encode an OptionSet by converting it to its 
65         raw bitmask state. 
66
67         * loader/ResourceLoadObserver.h:
68         * loader/ResourceLoadStatistics.cpp:
69         (WebCore::encodeHashSet):
70         (WebCore::encodeOriginHashSet):
71         (WebCore::encodeOptionSet):
72         (WebCore::encodeFontHashSet):
73         (WebCore::encodeCanvasActivityRecord):
74         (WebCore::ResourceLoadStatistics::encode const):
75         (WebCore::decodeHashSet):
76         (WebCore::decodeOriginHashSet):
77         (WebCore::decodeOptionSet):
78         (WebCore::decodeFontHashSet):
79         (WebCore::decodeCanvasActivityRecord):
80         (WebCore::ResourceLoadStatistics::decode):
81         (WebCore::navigatorAPIEnumToString):
82         (WebCore::screenAPIEnumToString):
83         (WebCore::appendNavigatorAPIOptionSet):
84         (WebCore::appendScreenAPIOptionSet):
85         (WebCore::ResourceLoadStatistics::toString const):
86         (WebCore::ResourceLoadStatistics::merge):
87         * loader/ResourceLoadStatistics.h:
88         * loader/ResourceTiming.cpp:
89
90         The following are the navigator functions recorded for the web API statistics.
91
92         * page/Navigator.cpp:
93         (WebCore::Navigator::appVersion const):
94         (WebCore::Navigator::userAgent const):
95         (WebCore::Navigator::plugins):
96         (WebCore::Navigator::mimeTypes):
97         (WebCore::Navigator::cookieEnabled const):
98         (WebCore::Navigator::javaEnabled const):
99
100         The following are the screen functions recorded for the web API statistics.
101
102         * page/Screen.cpp:
103         (WebCore::Screen::height const):
104         (WebCore::Screen::width const):
105         (WebCore::Screen::colorDepth const):
106         (WebCore::Screen::pixelDepth const):
107         (WebCore::Screen::availLeft const):
108         (WebCore::Screen::availTop const):
109         (WebCore::Screen::availHeight const):
110         (WebCore::Screen::availWidth const):
111
112 2018-09-11  Pablo Saavedra  <psaavedra@igalia.com>
113
114         playbackControlsManagerUpdateTimerFired and
115         m_playbackControlsManagerUpdateTimer must be
116         guarded with ENABLE(VIDEO), otherwise the following
117         error occurs with the VIDEO feature turned off:
118
119           error: 'MediaElementSession' has not been declared
120
121         Add missing #if ENABLE(VIDEO) Page.cpp and Page.h
122         https://bugs.webkit.org/show_bug.cgi?id=189500
123
124         Reviewed by Anders Carlsson.
125
126         * page/Page.cpp:
127         (WebCore::Page::Page):
128         (WebCore::Page::schedulePlaybackControlsManagerUpdate):
129         * page/Page.h:
130
131 2018-09-11  Frederic Wang  <fwang@igalia.com>
132
133         Refactor filter list checking code
134         https://bugs.webkit.org/show_bug.cgi?id=185087
135
136         Reviewed by Antonio Gomes.
137
138         No new tests, behavior unchanged.
139
140         * page/animation/KeyframeAnimation.h: Add missing forward-declaration FilterOperations.
141
142 == Rolled over to ChangeLog-2018-09-11 ==