| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2013 Google 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 are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 #ifndef WorkerThreadStartupData_h | |
| 32 #define WorkerThreadStartupData_h | |
| 33 | |
| 34 #include "bindings/core/v8/V8CacheOptions.h" | |
| 35 #include "core/CoreExport.h" | |
| 36 #include "core/frame/csp/ContentSecurityPolicy.h" | |
| 37 #include "core/workers/WorkerClients.h" | |
| 38 #include "core/workers/WorkerThread.h" | |
| 39 #include "platform/network/ContentSecurityPolicyParsers.h" | |
| 40 #include "platform/weborigin/KURL.h" | |
| 41 #include "wtf/Forward.h" | |
| 42 #include "wtf/Noncopyable.h" | |
| 43 | |
| 44 namespace blink { | |
| 45 | |
| 46 class WorkerClients; | |
| 47 | |
| 48 class CORE_EXPORT WorkerThreadStartupData final { | |
| 49 WTF_MAKE_NONCOPYABLE(WorkerThreadStartupData); | |
| 50 WTF_MAKE_FAST_ALLOCATED(WorkerThreadStartupData); | |
| 51 public: | |
| 52 static PassOwnPtr<WorkerThreadStartupData> create(const KURL& scriptURL, con
st String& userAgent, const String& sourceCode, PassOwnPtr<Vector<char>> cachedM
etaData, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, C
ontentSecurityPolicyHeaderType contentSecurityPolicyType, const SecurityOrigin*
starterOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> workerClients, V8CacheOptio
ns v8CacheOptions = V8CacheOptionsDefault) | |
| 53 { | |
| 54 return adoptPtr(new WorkerThreadStartupData(scriptURL, userAgent, source
Code, cachedMetaData, startMode, contentSecurityPolicy, contentSecurityPolicyTyp
e, starterOrigin, workerClients, v8CacheOptions)); | |
| 55 } | |
| 56 | |
| 57 ~WorkerThreadStartupData(); | |
| 58 | |
| 59 KURL m_scriptURL; | |
| 60 String m_userAgent; | |
| 61 String m_sourceCode; | |
| 62 OwnPtr<Vector<char>> m_cachedMetaData; | |
| 63 WorkerThreadStartMode m_startMode; | |
| 64 String m_contentSecurityPolicy; | |
| 65 ContentSecurityPolicyHeaderType m_contentSecurityPolicyType; | |
| 66 | |
| 67 // The SecurityOrigin of the Document creating a Worker may have | |
| 68 // been configured with extra policy privileges when it was created | |
| 69 // (e.g., enforce path-based file:// origins.) | |
| 70 // To ensure that these are transferred to the origin of a new worker | |
| 71 // global scope, supply the Document's SecurityOrigin as the | |
| 72 // 'starter origin'. | |
| 73 // | |
| 74 // Ownership of this optional starter origin remain with the caller, | |
| 75 // and is assumed to stay alive until the new Worker thread has been | |
| 76 // initialized. | |
| 77 // | |
| 78 // See SecurityOrigin::transferPrivilegesFrom() for details on what | |
| 79 // privileges are transferred. | |
| 80 const SecurityOrigin* m_starterOrigin; | |
| 81 | |
| 82 // This object is created and initialized on the thread creating | |
| 83 // a new worker context, but ownership of it and this WorkerThreadStartupDat
a | |
| 84 // structure is passed along to the new worker thread, where it is finalized
. | |
| 85 // | |
| 86 // Hence, CrossThreadPersistent<> is required to allow finalization | |
| 87 // to happen on a thread different than the thread creating the | |
| 88 // persistent reference. | |
| 89 OwnPtrWillBeCrossThreadPersistent<WorkerClients> m_workerClients; | |
| 90 | |
| 91 V8CacheOptions m_v8CacheOptions; | |
| 92 | |
| 93 private: | |
| 94 WorkerThreadStartupData(const KURL& scriptURL, const String& userAgent, cons
t String& sourceCode, PassOwnPtr<Vector<char>> cachedMetaData, WorkerThreadStart
Mode, const String& contentSecurityPolicy, ContentSecurityPolicyHeaderType conte
ntSecurityPolicyType, const SecurityOrigin*, PassOwnPtrWillBeRawPtr<WorkerClient
s>, V8CacheOptions); | |
| 95 }; | |
| 96 | |
| 97 } // namespace blink | |
| 98 | |
| 99 #endif // WorkerThreadStartupData_h | |
| OLD | NEW |