1 | /* |
2 | * Copyright (C) 2014 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 "APIProcessPoolConfiguration.h" |
28 | |
29 | #include "APIWebsiteDataStore.h" |
30 | #include "WebProcessPool.h" |
31 | |
32 | namespace API { |
33 | |
34 | Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::create() |
35 | { |
36 | return adoptRef(*new ProcessPoolConfiguration); |
37 | } |
38 | |
39 | Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::createWithLegacyOptions() |
40 | { |
41 | auto configuration = ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration(WebsiteDataStore::legacyDefaultDataStoreConfiguration()); |
42 | |
43 | configuration->m_shouldHaveLegacyDataStore = true; |
44 | configuration->m_cacheModel = WebKit::CacheModel::DocumentViewer; |
45 | |
46 | return configuration; |
47 | } |
48 | |
49 | Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration(const WebKit::WebsiteDataStoreConfiguration& legacyConfiguration) |
50 | { |
51 | auto configuration = ProcessPoolConfiguration::create(); |
52 | |
53 | configuration->m_applicationCacheDirectory = legacyConfiguration.applicationCacheDirectory(); |
54 | configuration->m_applicationCacheFlatFileSubdirectoryName = legacyConfiguration.applicationCacheFlatFileSubdirectoryName(); |
55 | configuration->m_diskCacheDirectory = legacyConfiguration.networkCacheDirectory(); |
56 | configuration->m_mediaCacheDirectory = legacyConfiguration.mediaCacheDirectory(); |
57 | configuration->m_indexedDBDatabaseDirectory = legacyConfiguration.indexedDBDatabaseDirectory(); |
58 | configuration->m_localStorageDirectory = legacyConfiguration.localStorageDirectory(); |
59 | configuration->m_deviceIdHashSaltsStorageDirectory = legacyConfiguration.deviceIdHashSaltsStorageDirectory(); |
60 | configuration->m_mediaKeysStorageDirectory = legacyConfiguration.mediaKeysStorageDirectory(); |
61 | configuration->m_resourceLoadStatisticsDirectory = legacyConfiguration.resourceLoadStatisticsDirectory(); |
62 | configuration->m_webSQLDatabaseDirectory = legacyConfiguration.webSQLDatabaseDirectory(); |
63 | configuration->m_javaScriptConfigurationDirectory = legacyConfiguration.javaScriptConfigurationDirectory(); |
64 | |
65 | return configuration; |
66 | } |
67 | |
68 | ProcessPoolConfiguration::ProcessPoolConfiguration() |
69 | : m_applicationCacheDirectory(WebsiteDataStore::defaultApplicationCacheDirectory()) |
70 | , m_applicationCacheFlatFileSubdirectoryName("Files" ) |
71 | , m_diskCacheDirectory(WebsiteDataStore::defaultNetworkCacheDirectory()) |
72 | , m_mediaCacheDirectory(WebsiteDataStore::defaultMediaCacheDirectory()) |
73 | , m_indexedDBDatabaseDirectory(WebsiteDataStore::defaultIndexedDBDatabaseDirectory()) |
74 | , m_localStorageDirectory(WebsiteDataStore::defaultLocalStorageDirectory()) |
75 | , m_deviceIdHashSaltsStorageDirectory(WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory()) |
76 | , m_webSQLDatabaseDirectory(WebsiteDataStore::defaultWebSQLDatabaseDirectory()) |
77 | , m_mediaKeysStorageDirectory(WebsiteDataStore::defaultMediaKeysStorageDirectory()) |
78 | , m_resourceLoadStatisticsDirectory(WebsiteDataStore::defaultResourceLoadStatisticsDirectory()) |
79 | , m_javaScriptConfigurationDirectory(WebsiteDataStore::defaultJavaScriptConfigurationDirectory()) |
80 | { |
81 | } |
82 | |
83 | ProcessPoolConfiguration::~ProcessPoolConfiguration() |
84 | { |
85 | } |
86 | |
87 | Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::copy() |
88 | { |
89 | auto copy = this->create(); |
90 | |
91 | copy->m_shouldHaveLegacyDataStore = this->m_shouldHaveLegacyDataStore; |
92 | copy->m_cacheModel = this->m_cacheModel; |
93 | copy->m_diskCacheDirectory = this->m_diskCacheDirectory; |
94 | copy->m_diskCacheSpeculativeValidationEnabled = this->m_diskCacheSpeculativeValidationEnabled; |
95 | copy->m_applicationCacheDirectory = this->m_applicationCacheDirectory; |
96 | copy->m_applicationCacheFlatFileSubdirectoryName = this->m_applicationCacheFlatFileSubdirectoryName; |
97 | copy->m_mediaCacheDirectory = this->m_mediaCacheDirectory; |
98 | copy->m_indexedDBDatabaseDirectory = this->m_indexedDBDatabaseDirectory; |
99 | copy->m_injectedBundlePath = this->m_injectedBundlePath; |
100 | copy->m_localStorageDirectory = this->m_localStorageDirectory; |
101 | copy->m_deviceIdHashSaltsStorageDirectory = this->m_deviceIdHashSaltsStorageDirectory; |
102 | copy->m_mediaKeysStorageDirectory = this->m_mediaKeysStorageDirectory; |
103 | copy->m_resourceLoadStatisticsDirectory = this->m_resourceLoadStatisticsDirectory; |
104 | copy->m_javaScriptConfigurationDirectory = this->m_javaScriptConfigurationDirectory; |
105 | copy->m_webSQLDatabaseDirectory = this->m_webSQLDatabaseDirectory; |
106 | copy->m_cachePartitionedURLSchemes = this->m_cachePartitionedURLSchemes; |
107 | copy->m_alwaysRevalidatedURLSchemes = this->m_alwaysRevalidatedURLSchemes; |
108 | copy->m_additionalReadAccessAllowedPaths = this->m_additionalReadAccessAllowedPaths; |
109 | copy->m_fullySynchronousModeIsAllowedForTesting = this->m_fullySynchronousModeIsAllowedForTesting; |
110 | copy->m_ignoreSynchronousMessagingTimeoutsForTesting = this->m_ignoreSynchronousMessagingTimeoutsForTesting; |
111 | copy->m_attrStyleEnabled = this->m_attrStyleEnabled; |
112 | copy->m_overrideLanguages = this->m_overrideLanguages; |
113 | copy->m_alwaysRunsAtBackgroundPriority = this->m_alwaysRunsAtBackgroundPriority; |
114 | copy->m_shouldTakeUIBackgroundAssertion = this->m_shouldTakeUIBackgroundAssertion; |
115 | copy->m_shouldCaptureAudioInUIProcess = this->m_shouldCaptureAudioInUIProcess; |
116 | copy->m_shouldCaptureDisplayInUIProcess = this->m_shouldCaptureDisplayInUIProcess; |
117 | copy->m_isJITEnabled = this->m_isJITEnabled; |
118 | copy->m_downloadMonitorSpeedMultiplier = this->m_downloadMonitorSpeedMultiplier; |
119 | #if PLATFORM(IOS_FAMILY) |
120 | copy->m_ctDataConnectionServiceType = this->m_ctDataConnectionServiceType; |
121 | #endif |
122 | copy->m_presentingApplicationPID = this->m_presentingApplicationPID; |
123 | copy->m_processSwapsOnNavigationFromClient = this->m_processSwapsOnNavigationFromClient; |
124 | copy->m_processSwapsOnNavigationFromExperimentalFeatures = this->m_processSwapsOnNavigationFromExperimentalFeatures; |
125 | copy->m_alwaysKeepAndReuseSwappedProcesses = this->m_alwaysKeepAndReuseSwappedProcesses; |
126 | copy->m_processSwapsOnWindowOpenWithOpener = this->m_processSwapsOnWindowOpenWithOpener; |
127 | copy->m_isAutomaticProcessWarmingEnabledByClient = this->m_isAutomaticProcessWarmingEnabledByClient; |
128 | copy->m_usesWebProcessCache = this->m_usesWebProcessCache; |
129 | #if PLATFORM(COCOA) |
130 | copy->m_suppressesConnectionTerminationOnSystemChange = this->m_suppressesConnectionTerminationOnSystemChange; |
131 | #endif |
132 | copy->m_customWebContentServiceBundleIdentifier = this->m_customWebContentServiceBundleIdentifier; |
133 | copy->m_usesSingleWebProcess = m_usesSingleWebProcess; |
134 | copy->m_hstsStorageDirectory = m_hstsStorageDirectory; |
135 | |
136 | return copy; |
137 | } |
138 | |
139 | } // namespace API |
140 | |