Ignore contiguous composition event.
[framework/web/webkit-efl.git] / Source / WebKit2 / Shared / WebProcessCreationParameters.cpp
1 /*
2  * Copyright (C) 2010 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  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #include "config.h"
27 #include "WebProcessCreationParameters.h"
28
29 #include "ArgumentCoders.h"
30 #if USE(CFURLSTORAGESESSIONS) && PLATFORM(WIN)
31 #include "ArgumentCodersCF.h"
32 #endif
33
34 namespace WebKit {
35
36 WebProcessCreationParameters::WebProcessCreationParameters()
37     : shouldTrackVisitedLinks(false)
38     , shouldAlwaysUseComplexTextCodePath(false)
39     , shouldUseFontSmoothing(true)
40     , defaultRequestTimeoutInterval(INT_MAX)
41 #if PLATFORM(MAC)
42     , nsURLCacheMemoryCapacity(0)
43     , nsURLCacheDiskCapacity(0)
44 #elif PLATFORM(WIN)
45     , shouldPaintNativeControls(false)
46 #endif
47 {
48 }
49
50 void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const
51 {
52     encoder->encode(injectedBundlePath);
53     encoder->encode(injectedBundlePathExtensionHandle);
54     encoder->encode(applicationCacheDirectory);
55     encoder->encode(databaseDirectory);
56 #if ENABLE(TIZEN_FILE_SYSTEM)
57     encoder->encode(localFileSystemDirectory);
58 #endif
59     encoder->encode(localStorageDirectory);
60 #if ENABLE(TIZEN_INDEXED_DATABASE)
61     encoder->encode(indexedDatabaseDirectory);
62 #endif
63 #if ENABLE(TIZEN_WEBKIT2_PROXY)
64     encoder->encode(proxyAddress);
65 #endif
66 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
67     encoder->encode(certificateFile);
68 #endif
69     encoder->encode(urlSchemesRegistererdAsEmptyDocument);
70     encoder->encode(urlSchemesRegisteredAsSecure);
71     encoder->encode(urlSchemesForWhichDomainRelaxationIsForbidden);
72     encoder->encode(mimeTypesWithCustomRepresentation);
73     encoder->encodeEnum(cacheModel);
74     encoder->encode(shouldTrackVisitedLinks);
75     encoder->encode(shouldAlwaysUseComplexTextCodePath);
76     encoder->encode(shouldUseFontSmoothing);
77     encoder->encode(iconDatabaseEnabled);
78 #if ENABLE(PLUGIN_PROCESS)
79     encoder->encode(disablePluginProcessMessageTimeout);
80 #endif
81     encoder->encode(languages);
82     encoder->encode(textCheckerState);
83     encoder->encode(fullKeyboardAccessEnabled);
84     encoder->encode(defaultRequestTimeoutInterval);
85 #if PLATFORM(MAC) || USE(CFURLSTORAGESESSIONS)
86     encoder->encode(uiProcessBundleIdentifier);
87 #endif
88 #if PLATFORM(MAC)
89     encoder->encode(parentProcessName);
90     encoder->encode(presenterApplicationPid);
91     encoder->encode(nsURLCachePath);
92     encoder->encode(nsURLCacheMemoryCapacity);
93     encoder->encode(nsURLCacheDiskCapacity);
94     encoder->encode(acceleratedCompositingPort);
95     encoder->encode(uiProcessBundleResourcePath);
96     encoder->encode(webInspectorBaseDirectory);
97 #elif PLATFORM(WIN)
98     encoder->encode(shouldPaintNativeControls);
99     encoder->encode(cfURLCachePath);
100     encoder->encode(cfURLCacheDiskCapacity);
101     encoder->encode(cfURLCacheMemoryCapacity);
102     encoder->encode(initialHTTPCookieAcceptPolicy);
103 #if USE(CFURLSTORAGESESSIONS)
104     CFDataRef storageSession = serializedDefaultStorageSession.get();
105     encoder->encodeBool(storageSession);
106     if (storageSession)
107         CoreIPC::encode(encoder, storageSession);
108 #endif // USE(CFURLSTORAGESESSIONS)
109 #endif
110 #if PLATFORM(QT)
111     encoder->encode(cookieStorageDirectory);
112     encoder->encode(diskCacheDirectory);
113 #endif
114 #if ENABLE(TIZEN_SOUP_COOKIE_CACHE_FOR_WEBKIT2)
115 #if USE(SOUP)
116     encoder->encode(soupDataDirectory);
117 #endif
118 #endif
119
120 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
121     encoder->encode(notificationPermissions);
122 #endif
123 }
124
125 bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, WebProcessCreationParameters& parameters)
126 {
127     if (!decoder->decode(parameters.injectedBundlePath))
128         return false;
129     if (!decoder->decode(parameters.injectedBundlePathExtensionHandle))
130         return false;
131     if (!decoder->decode(parameters.applicationCacheDirectory))
132         return false;
133     if (!decoder->decode(parameters.databaseDirectory))
134         return false;
135 #if ENABLE(TIZEN_FILE_SYSTEM)
136     if (!decoder->decode(parameters.localFileSystemDirectory))
137         return false;
138 #endif
139     if (!decoder->decode(parameters.localStorageDirectory))
140         return false;
141 #if ENABLE(TIZEN_INDEXED_DATABASE)
142     if (!decoder->decode(parameters.indexedDatabaseDirectory))
143         return false;
144 #endif
145 #if ENABLE(TIZEN_WEBKIT2_PROXY)
146     if (!decoder->decode(parameters.proxyAddress))
147         return false;
148 #endif
149 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
150     if (!decoder->decode(parameters.certificateFile))
151         return false;
152 #endif
153     if (!decoder->decode(parameters.urlSchemesRegistererdAsEmptyDocument))
154         return false;
155     if (!decoder->decode(parameters.urlSchemesRegisteredAsSecure))
156         return false;
157     if (!decoder->decode(parameters.urlSchemesForWhichDomainRelaxationIsForbidden))
158         return false;
159     if (!decoder->decode(parameters.mimeTypesWithCustomRepresentation))
160         return false;
161     if (!decoder->decodeEnum(parameters.cacheModel))
162         return false;
163     if (!decoder->decode(parameters.shouldTrackVisitedLinks))
164         return false;
165     if (!decoder->decode(parameters.shouldAlwaysUseComplexTextCodePath))
166         return false;
167     if (!decoder->decode(parameters.shouldUseFontSmoothing))
168         return false;
169     if (!decoder->decode(parameters.iconDatabaseEnabled))
170         return false;
171 #if ENABLE(PLUGIN_PROCESS)
172     if (!decoder->decode(parameters.disablePluginProcessMessageTimeout))
173         return false;
174 #endif
175
176     if (!decoder->decode(parameters.languages))
177         return false;
178     if (!decoder->decode(parameters.textCheckerState))
179         return false;
180     if (!decoder->decode(parameters.fullKeyboardAccessEnabled))
181         return false;
182     if (!decoder->decode(parameters.defaultRequestTimeoutInterval))
183         return false;
184 #if PLATFORM(MAC) || USE(CFURLSTORAGESESSIONS)
185     if (!decoder->decode(parameters.uiProcessBundleIdentifier))
186         return false;
187 #endif
188
189 #if PLATFORM(MAC)
190     if (!decoder->decode(parameters.parentProcessName))
191         return false;
192     if (!decoder->decode(parameters.presenterApplicationPid))
193         return false;
194     if (!decoder->decode(parameters.nsURLCachePath))
195         return false;
196     if (!decoder->decode(parameters.nsURLCacheMemoryCapacity))
197         return false;
198     if (!decoder->decode(parameters.nsURLCacheDiskCapacity))
199         return false;
200     if (!decoder->decode(parameters.acceleratedCompositingPort))
201         return false;
202     if (!decoder->decode(parameters.uiProcessBundleResourcePath))
203         return false;
204     if (!decoder->decode(parameters.webInspectorBaseDirectory))
205         return false;
206 #elif PLATFORM(WIN)
207     if (!decoder->decode(parameters.shouldPaintNativeControls))
208         return false;
209     if (!decoder->decode(parameters.cfURLCachePath))
210         return false;
211     if (!decoder->decode(parameters.cfURLCacheDiskCapacity))
212         return false;
213     if (!decoder->decode(parameters.cfURLCacheMemoryCapacity))
214         return false;
215     if (!decoder->decode(parameters.initialHTTPCookieAcceptPolicy))
216         return false;
217 #if USE(CFURLSTORAGESESSIONS)
218     bool hasStorageSession = false;
219     if (!decoder->decode(hasStorageSession))
220         return false;
221     if (hasStorageSession && !CoreIPC::decode(decoder, parameters.serializedDefaultStorageSession))
222         return false;
223 #endif // USE(CFURLSTORAGESESSIONS)
224 #endif
225
226 #if PLATFORM(QT)
227     if (!decoder->decode(parameters.cookieStorageDirectory))
228         return false;
229     if (!decoder->decode(parameters.diskCacheDirectory))
230         return false;
231 #endif
232 #if ENABLE(TIZEN_SOUP_COOKIE_CACHE_FOR_WEBKIT2)
233 #if USE(SOUP)
234     if (!decoder->decode(parameters.soupDataDirectory))
235         return false;
236 #endif
237 #endif
238
239 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
240     if (!decoder->decode(parameters.notificationPermissions))
241         return false;
242 #endif
243
244     return true;
245 }
246
247 } // namespace WebKit