Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Side by Side Diff: Source/core/workers/WorkerThreadStartupData.h

Issue 1041053005: Oilpan: fix WorkerThreadStartupData finalization handling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add comment clarifying use of CrossThreadPersistent<> Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/workers/WorkerThread.cpp ('k') | Source/core/workers/WorkerThreadStartupData.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 27 matching lines...) Expand all
38 #include "core/workers/WorkerThread.h" 38 #include "core/workers/WorkerThread.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 : public NoBaseWillBeGarbageColl ectedFinalized<WorkerThreadStartupData> { 48 class CORE_EXPORT WorkerThreadStartupData final {
49 WTF_MAKE_NONCOPYABLE(WorkerThreadStartupData); 49 WTF_MAKE_NONCOPYABLE(WorkerThreadStartupData);
50 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(WorkerThreadStartupData); 50 WTF_MAKE_FAST_ALLOCATED(WorkerThreadStartupData);
51 public: 51 public:
52 static PassOwnPtrWillBeRawPtr<WorkerThreadStartupData> create(const KURL& sc riptURL, const String& userAgent, const String& sourceCode, PassOwnPtr<Vector<ch ar>> cachedMetaData, WorkerThreadStartMode startMode, const String& contentSecur ityPolicy, ContentSecurityPolicyHeaderType contentSecurityPolicyType, const Secu rityOrigin* starterOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> workerClients, V8CacheOptions v8CacheOptions = V8CacheOptionsDefault) 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 { 53 {
54 return adoptPtrWillBeNoop(new WorkerThreadStartupData(scriptURL, userAge nt, sourceCode, cachedMetaData, startMode, contentSecurityPolicy, contentSecurit yPolicyType, starterOrigin, workerClients, v8CacheOptions)); 54 return adoptPtr(new WorkerThreadStartupData(scriptURL, userAgent, source Code, cachedMetaData, startMode, contentSecurityPolicy, contentSecurityPolicyTyp e, starterOrigin, workerClients, v8CacheOptions));
55 } 55 }
56 56
57 ~WorkerThreadStartupData(); 57 ~WorkerThreadStartupData();
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 OwnPtrWillBeMember<WorkerClients> m_workerClients; 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;
82 90
83 V8CacheOptions m_v8CacheOptions; 91 V8CacheOptions m_v8CacheOptions;
84 92
85 DECLARE_TRACE();
86
87 private: 93 private:
88 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 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);
89 }; 95 };
90 96
91 } // namespace blink 97 } // namespace blink
92 98
93 #endif // WorkerThreadStartupData_h 99 #endif // WorkerThreadStartupData_h
OLDNEW
« no previous file with comments | « Source/core/workers/WorkerThread.cpp ('k') | Source/core/workers/WorkerThreadStartupData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698