Source/WebCore: Update low memory handler to use new memory pressure notifications...
[WebKit-https.git] / Source / WebKit / mac / WebCoreSupport / WebSystemInterface.mm
1 /*
2  * Copyright 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1.  Redistributions of source code must retain the above copyright
9  *     notice, this list of conditions and the following disclaimer. 
10  * 2.  Redistributions in binary form must reproduce the above copyright
11  *     notice, this list of conditions and the following disclaimer in the
12  *     documentation and/or other materials provided with the distribution. 
13  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14  *     its contributors may be used to endorse or promote products derived
15  *     from this software without specific prior written permission. 
16  *
17  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28
29 #import "WebSystemInterface.h"
30
31 // Needed for builds not using PCH to expose BUILDING_ macros, see bug 32753.
32 #include <wtf/Platform.h>
33
34 #import <WebCore/WebCoreSystemInterface.h>
35 #import <WebKitSystemInterface.h>
36
37 #define INIT(function) wk##function = WK##function
38
39 void InitWebCoreSystemInterface(void)
40 {
41     static bool didInit;
42     if (didInit)
43         return;
44
45     INIT(AdvanceDefaultButtonPulseAnimation);
46 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
47     INIT(CALayerEnumerateRectsBeingDrawnWithBlock);
48 #endif
49     INIT(CGContextGetShouldSmoothFonts);
50     INIT(CGPatternCreateWithImageAndTransform);
51     INIT(CGContextResetClip);
52 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
53     INIT(CGContextDrawsWithCorrectShadowOffsets);
54 #endif
55 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
56     INIT(CTFontTransformGlyphs);
57 #endif
58     INIT(CopyCFLocalizationPreferredName);
59     INIT(CopyCONNECTProxyResponse);
60     INIT(CopyNSURLResponseStatusLine);
61 #if PLATFORM(MAC)
62     INIT(CopyNSURLResponseCertificateChain);
63 #endif
64     INIT(CreateCustomCFReadStream);
65     INIT(DrawCapsLockIndicator);
66     INIT(DrawBezeledTextArea);
67     INIT(DrawBezeledTextFieldCell);
68     INIT(DrawFocusRing);
69     INIT(DrawMediaUIPart);
70     INIT(DrawMediaSliderTrack);
71     INIT(DrawTextFieldCellFocusRing);
72     INIT(GetExtensionsForMIMEType);
73     INIT(GetFontInLanguageForCharacter);
74     INIT(GetFontInLanguageForRange);
75     INIT(GetGlyphTransformedAdvances);
76     INIT(GetHTTPPipeliningPriority);
77     INIT(GetMIMETypeForExtension);
78     INIT(GetNSURLResponseLastModifiedDate);
79     INIT(SignedPublicKeyAndChallengeString);
80     INIT(GetPreferredExtensionForMIMEType);
81     INIT(GetWheelEventDeltas);
82 #if PLATFORM(MAC)
83     INIT(GetNSEventKeyChar);
84 #endif
85     INIT(HitTestMediaUIPart);
86     INIT(InitializeMaximumHTTPConnectionCountPerHost);
87     INIT(MeasureMediaUIPart);
88     INIT(CreateMediaUIBackgroundView);
89     INIT(CreateMediaUIControl);
90     INIT(WindowSetAlpha);
91     INIT(WindowSetScaledFrame);
92     INIT(MediaControllerThemeAvailable);
93     INIT(PopupMenu);
94     INIT(SetBaseCTM);
95     INIT(SetCGFontRenderingMode);
96     INIT(SetCONNECTProxyAuthorizationForStream);
97     INIT(SetCONNECTProxyForStream);
98     INIT(SetDragImage);
99     INIT(SetHTTPPipeliningMaximumPriority);
100     INIT(SetHTTPPipeliningPriority);
101     INIT(SetHTTPPipeliningMinimumFastLanePriority);
102     INIT(SetNSURLConnectionDefersCallbacks);
103     INIT(SetNSURLRequestShouldContentSniff);
104     INIT(SetPatternPhaseInUserSpace);
105     INIT(GetUserToBaseCTM);
106     INIT(SetUpFontCache);
107     INIT(SignalCFReadStreamEnd);
108     INIT(SignalCFReadStreamError);
109     INIT(SignalCFReadStreamHasBytes);
110     INIT(QTIncludeOnlyModernMediaFileTypes);
111     INIT(QTMovieDataRate);
112     INIT(QTMovieDisableComponent);
113     INIT(QTMovieMaxTimeLoaded);
114     INIT(QTMovieMaxTimeLoadedChangeNotification);
115     INIT(QTMovieMaxTimeSeekable);
116     INIT(QTMovieGetType);
117     INIT(QTMovieHasClosedCaptions);
118     INIT(QTMovieResolvedURL);
119     INIT(QTMovieSetShowClosedCaptions);
120     INIT(QTMovieSelectPreferredAlternates);
121     INIT(QTMovieViewSetDrawSynchronously);
122     INIT(QTGetSitesInMediaDownloadCache);
123     INIT(QTClearMediaDownloadCacheForSite);
124     INIT(QTClearMediaDownloadCache);
125
126     INIT(GetGlyphsForCharacters);
127     INIT(GetVerticalGlyphsForCharacters);
128
129 #if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
130     INIT(GetHyphenationLocationBeforeIndex);
131     INIT(GetNSEventMomentumPhase);
132 #endif
133
134     INIT(CreateCTLineWithUniCharProvider);
135
136 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
137     INIT(IOSurfaceContextCreate);
138     INIT(IOSurfaceContextCreateImage);
139     INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
140     INIT(CTRunGetInitialAdvance);
141     INIT(RecommendedScrollerStyle);
142     INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard);
143     INIT(SetCrashReportApplicationSpecificInformation);
144     INIT(CopyDefaultSearchProviderDisplayName);
145     INIT(AVAssetResolvedURL);
146     INIT(Cursor);
147 #endif
148 #if USE(CFNETWORK)
149     INIT(GetDefaultHTTPCookieStorage);
150     INIT(CopyCredentialFromCFPersistentStorage);
151     INIT(SetCFURLRequestShouldContentSniff);
152     INIT(CFURLRequestCopyHTTPRequestBodyParts);
153     INIT(CFURLRequestSetHTTPRequestBodyParts);
154     INIT(SetRequestStorageSession);
155 #endif
156
157 #if PLATFORM(MAC)
158     INIT(SpeechSynthesisGetVoiceIdentifiers);
159     INIT(SpeechSynthesisGetDefaultVoiceIdentifierForLocale);
160 #endif
161     INIT(GetAXTextMarkerTypeID);
162     INIT(GetAXTextMarkerRangeTypeID);
163     INIT(CreateAXTextMarker);
164     INIT(GetBytesFromAXTextMarker);
165     INIT(CreateAXTextMarkerRange);
166     INIT(CopyAXTextMarkerRangeStart);
167     INIT(CopyAXTextMarkerRangeEnd);
168     INIT(AccessibilityHandleFocusChanged);
169     INIT(CreateAXUIElementRef);
170     INIT(UnregisterUniqueIdForElement);
171     INIT(CreatePrivateStorageSession);
172     INIT(CopyRequestWithStorageSession);
173     INIT(CopyHTTPCookieStorage);
174     INIT(GetHTTPCookieAcceptPolicy);
175 #if PLATFORM(MAC)
176     INIT(HTTPCookies);
177 #endif
178     INIT(HTTPCookiesForURL);
179     INIT(SetHTTPCookiesForURL);
180 #if PLATFORM(MAC)
181     INIT(DeleteAllHTTPCookies);
182 #endif
183     INIT(DeleteHTTPCookie);
184
185     INIT(GetCFURLResponseMIMEType);
186     INIT(GetCFURLResponseURL);
187     INIT(GetCFURLResponseHTTPResponse);
188     INIT(CopyCFURLResponseSuggestedFilename);
189     INIT(SetCFURLResponseMIMEType);
190
191     INIT(SetMetadataURL);
192
193 #if PLATFORM(MAC)
194     // FIXME: We should stop using this file in Chromium.
195
196     INIT(DestroyRenderingResources);
197
198 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
199     INIT(CreateVMPressureDispatchOnMainQueue);
200 #endif
201     
202 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
203     INIT(CreateMemoryStatusPressureCriticalDispatchOnMainQueue);
204 #endif
205
206 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
207     INIT(ExecutableWasLinkedOnOrBeforeLion);
208 #endif
209
210 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
211     INIT(CGPathAddRoundedRect);
212 #endif
213
214 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
215     INIT(CFURLRequestAllowAllPostCaching);
216 #endif
217
218 #if USE(CONTENT_FILTERING)
219     INIT(FilterIsManagedSession);
220     INIT(FilterCreateInstance);
221     INIT(FilterWasBlocked);
222     INIT(FilterIsBuffering);
223     INIT(FilterAddData);
224     INIT(FilterDataComplete);
225 #endif
226
227 #if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
228     INIT(NSElasticDeltaForTimeDelta);
229     INIT(NSElasticDeltaForReboundDelta);
230     INIT(NSReboundDeltaForElasticDelta);
231 #endif
232
233 #if ENABLE(PUBLIC_SUFFIX_LIST)
234     INIT(IsPublicSuffix);
235 #endif
236
237 #if ENABLE(CACHE_PARTITIONING)
238     INIT(CachePartitionKey);
239 #endif
240
241 #endif
242     didInit = true;
243 }