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