[iOS] We should not take a background assertion for the UIProcess when app is MobileMail
[WebKit-https.git] / Source / WebKit2 / UIProcess / API / APIProcessPoolConfiguration.h
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 #ifndef APIContextConfiguration_h
27 #define APIContextConfiguration_h
28
29 #include "APIObject.h"
30 #include "CacheModel.h"
31 #include "WebsiteDataStore.h"
32 #include <wtf/Ref.h>
33 #include <wtf/Vector.h>
34 #include <wtf/text/WTFString.h>
35
36 namespace API {
37
38 class ProcessPoolConfiguration final : public ObjectImpl<Object::Type::ProcessPoolConfiguration> {
39 public:
40     static Ref<ProcessPoolConfiguration> create();
41     static Ref<ProcessPoolConfiguration> createWithLegacyOptions();
42     static Ref<ProcessPoolConfiguration> createWithWebsiteDataStoreConfiguration(const WebKit::WebsiteDataStore::Configuration&);
43
44     explicit ProcessPoolConfiguration();
45     virtual ~ProcessPoolConfiguration();
46     
47     Ref<ProcessPoolConfiguration> copy();
48
49     bool shouldHaveLegacyDataStore() const { return m_shouldHaveLegacyDataStore; }
50     void setShouldHaveLegacyDataStore(bool shouldHaveLegacyDataStore) { m_shouldHaveLegacyDataStore = shouldHaveLegacyDataStore; }
51
52     unsigned maximumProcessCount() const { return m_maximumProcessCount; }
53     void setMaximumProcessCount(unsigned maximumProcessCount) { m_maximumProcessCount = maximumProcessCount; } 
54
55     bool diskCacheSpeculativeValidationEnabled() const { return m_diskCacheSpeculativeValidationEnabled; }
56     void setDiskCacheSpeculativeValidationEnabled(bool enabled) { m_diskCacheSpeculativeValidationEnabled = enabled; }
57
58     WebKit::CacheModel cacheModel() const { return m_cacheModel; }
59     void setCacheModel(WebKit::CacheModel cacheModel) { m_cacheModel = cacheModel; }
60
61     int64_t diskCacheSizeOverride() const { return m_diskCacheSizeOverride; }
62     void setDiskCacheSizeOverride(int64_t size) { m_diskCacheSizeOverride = size; }
63
64     const WTF::String& applicationCacheDirectory() const { return m_applicationCacheDirectory; }
65     void setApplicationCacheDirectory(const WTF::String& applicationCacheDirectory) { m_applicationCacheDirectory = applicationCacheDirectory; }
66
67     const WTF::String& applicationCacheFlatFileSubdirectoryName() const { return m_applicationCacheFlatFileSubdirectoryName; }
68
69     const WTF::String& diskCacheDirectory() const { return m_diskCacheDirectory; }
70     void setDiskCacheDirectory(const WTF::String& diskCacheDirectory) { m_diskCacheDirectory = diskCacheDirectory; }
71
72     const WTF::String& mediaCacheDirectory() const { return m_mediaCacheDirectory; }
73     void setMediaCacheDirectory(const WTF::String& mediaCacheDirectory) { m_mediaCacheDirectory = mediaCacheDirectory; }
74     
75     const WTF::String& indexedDBDatabaseDirectory() const { return m_indexedDBDatabaseDirectory; }
76     void setIndexedDBDatabaseDirectory(const WTF::String& indexedDBDatabaseDirectory) { m_indexedDBDatabaseDirectory = indexedDBDatabaseDirectory; }
77
78     const WTF::String& injectedBundlePath() const { return m_injectedBundlePath; }
79     void setInjectedBundlePath(const WTF::String& injectedBundlePath) { m_injectedBundlePath = injectedBundlePath; }
80
81     const WTF::String& localStorageDirectory() const { return m_localStorageDirectory; }
82     void setLocalStorageDirectory(const WTF::String& localStorageDirectory) { m_localStorageDirectory = localStorageDirectory; }
83
84     const WTF::String& webSQLDatabaseDirectory() const { return m_webSQLDatabaseDirectory; }
85     void setWebSQLDatabaseDirectory(const WTF::String& webSQLDatabaseDirectory) { m_webSQLDatabaseDirectory = webSQLDatabaseDirectory; }
86
87     const WTF::String& mediaKeysStorageDirectory() const { return m_mediaKeysStorageDirectory; }
88     void setMediaKeysStorageDirectory(const WTF::String& mediaKeysStorageDirectory) { m_mediaKeysStorageDirectory = mediaKeysStorageDirectory; }
89
90     const WTF::String& javaScriptConfigurationDirectory() const { return m_javaScriptConfigurationDirectory; }
91     void setJavaScriptConfigurationDirectory(const WTF::String& javaScriptConfigurationDirectory) { m_javaScriptConfigurationDirectory = javaScriptConfigurationDirectory; }
92
93     const Vector<WTF::String>& cachePartitionedURLSchemes() { return m_cachePartitionedURLSchemes; }
94     void setCachePartitionedURLSchemes(Vector<WTF::String>&& cachePartitionedURLSchemes) { m_cachePartitionedURLSchemes = WTFMove(cachePartitionedURLSchemes); }
95
96     const Vector<WTF::String>& alwaysRevalidatedURLSchemes() { return m_alwaysRevalidatedURLSchemes; }
97     void setAlwaysRevalidatedURLSchemes(Vector<WTF::String>&& alwaysRevalidatedURLSchemes) { m_alwaysRevalidatedURLSchemes = WTFMove(alwaysRevalidatedURLSchemes); }
98
99     const Vector<WTF::String>& additionalReadAccessAllowedPaths() { return m_additionalReadAccessAllowedPaths; }
100     void setAdditionalReadAccessAllowedPaths(Vector<WTF::String>&& additionalReadAccessAllowedPaths) { m_additionalReadAccessAllowedPaths = additionalReadAccessAllowedPaths; }
101
102     bool fullySynchronousModeIsAllowedForTesting() const { return m_fullySynchronousModeIsAllowedForTesting; }
103     void setFullySynchronousModeIsAllowedForTesting(bool allowed) { m_fullySynchronousModeIsAllowedForTesting = allowed; }
104
105     bool ignoreSynchronousMessagingTimeoutsForTesting() const { return m_ignoreSynchronousMessagingTimeoutsForTesting; }
106     void setIgnoreSynchronousMessagingTimeoutsForTesting(bool allowed) { m_ignoreSynchronousMessagingTimeoutsForTesting = allowed; }
107
108     const Vector<WTF::String>& overrideLanguages() const { return m_overrideLanguages; }
109     void setOverrideLanguages(Vector<WTF::String>&& languages) { m_overrideLanguages = WTFMove(languages); }
110
111     const WTF::String& sourceApplicationBundleIdentifier() const { return m_sourceApplicationBundleIdentifier; }
112     void setSourceApplicationBundleIdentifier(const WTF::String& sourceApplicationBundleIdentifier) { m_sourceApplicationBundleIdentifier = sourceApplicationBundleIdentifier; }
113
114     const WTF::String& sourceApplicationSecondaryIdentifier() const { return m_sourceApplicationSecondaryIdentifier; }
115     void setSourceApplicationSecondaryIdentifier(const WTF::String& sourceApplicationSecondaryIdentifier) { m_sourceApplicationSecondaryIdentifier = sourceApplicationSecondaryIdentifier; }
116
117     bool allowsCellularAccess() const { return m_allowsCellularAccess; }
118     void setAllowsCellularAccess(bool allowsCellularAccess) { m_allowsCellularAccess = allowsCellularAccess; }
119     
120     bool alwaysRunsAtBackgroundPriority() const { return m_alwaysRunsAtBackgroundPriority; }
121     void setAlwaysRunsAtBackgroundPriority(bool alwaysRunsAtBackgroundPriority) { m_alwaysRunsAtBackgroundPriority = alwaysRunsAtBackgroundPriority; }
122
123     bool shouldTakeUIBackgroundAssertion() const { return m_shouldTakeUIBackgroundAssertion; }
124     void setShouldTakeUIBackgroundAssertion(bool shouldTakeUIBackgroundAssertion) { m_shouldTakeUIBackgroundAssertion = shouldTakeUIBackgroundAssertion; }
125
126     bool shouldCaptureAudioInUIProcess() const { return m_shouldCaptureAudioInUIProcess; }
127     void setShouldCaptureAudioInUIProcess(bool shouldCaptureAudioInUIProcess) { m_shouldCaptureAudioInUIProcess = shouldCaptureAudioInUIProcess; }
128
129 #if PLATFORM(IOS)
130     const WTF::String& ctDataConnectionServiceType() const { return m_ctDataConnectionServiceType; }
131     void setCTDataConnectionServiceType(const WTF::String& ctDataConnectionServiceType) { m_ctDataConnectionServiceType = ctDataConnectionServiceType; }
132 #endif
133
134 private:
135     bool m_shouldHaveLegacyDataStore { false };
136
137     unsigned m_maximumProcessCount { 0 };
138     bool m_diskCacheSpeculativeValidationEnabled { false };
139     WebKit::CacheModel m_cacheModel { WebKit::CacheModelPrimaryWebBrowser };
140     int64_t m_diskCacheSizeOverride { -1 };
141
142     WTF::String m_applicationCacheDirectory;
143     WTF::String m_applicationCacheFlatFileSubdirectoryName;
144     WTF::String m_diskCacheDirectory;
145     WTF::String m_mediaCacheDirectory;
146     WTF::String m_indexedDBDatabaseDirectory;
147     WTF::String m_injectedBundlePath;
148     WTF::String m_localStorageDirectory;
149     WTF::String m_webSQLDatabaseDirectory;
150     WTF::String m_mediaKeysStorageDirectory;
151     WTF::String m_resourceLoadStatisticsDirectory;
152     WTF::String m_javaScriptConfigurationDirectory;
153     Vector<WTF::String> m_cachePartitionedURLSchemes;
154     Vector<WTF::String> m_alwaysRevalidatedURLSchemes;
155     Vector<WTF::String> m_additionalReadAccessAllowedPaths;
156     bool m_fullySynchronousModeIsAllowedForTesting { false };
157     bool m_ignoreSynchronousMessagingTimeoutsForTesting { false };
158     Vector<WTF::String> m_overrideLanguages;
159     WTF::String m_sourceApplicationBundleIdentifier;
160     WTF::String m_sourceApplicationSecondaryIdentifier;
161     bool m_allowsCellularAccess { true };
162     bool m_alwaysRunsAtBackgroundPriority { false };
163     bool m_shouldTakeUIBackgroundAssertion { true };
164     bool m_shouldCaptureAudioInUIProcess { false };
165 #if PLATFORM(IOS)
166     WTF::String m_ctDataConnectionServiceType;
167 #endif
168 };
169
170 } // namespace API
171
172 #endif // APIContextConfiguration_h