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

Side by Side Diff: third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h

Issue 2702243003: Disallow cross-thread Persistent<> read access. (Closed)
Patch Set: rebased upto r451733 Created 3 years, 10 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
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // to WorkerContext. 115 // to WorkerContext.
116 std::unique_ptr<WebWorkerContentSettingsClientProxy> m_contentSettingsClient; 116 std::unique_ptr<WebWorkerContentSettingsClientProxy> m_contentSettingsClient;
117 117
118 // We retain ownership of this one which is for use on the 118 // We retain ownership of this one which is for use on the
119 // main thread only. 119 // main thread only.
120 std::unique_ptr<WebServiceWorkerNetworkProvider> m_networkProvider; 120 std::unique_ptr<WebServiceWorkerNetworkProvider> m_networkProvider;
121 121
122 // Kept around only while main script loading is ongoing. 122 // Kept around only while main script loading is ongoing.
123 RefPtr<WorkerScriptLoader> m_mainScriptLoader; 123 RefPtr<WorkerScriptLoader> m_mainScriptLoader;
124 124
125 Persistent<ParentFrameTaskRunners> m_mainThreadTaskRunners; 125 // Owned by the main thread, but will be accessed by the worker when
126 // posting tasks.
127 CrossThreadPersistent<ParentFrameTaskRunners> m_mainThreadTaskRunners;
126 128
127 std::unique_ptr<WorkerThread> m_workerThread; 129 std::unique_ptr<WorkerThread> m_workerThread;
128 RefPtr<WorkerLoaderProxy> m_loaderProxy; 130 RefPtr<WorkerLoaderProxy> m_loaderProxy;
129 Persistent<ServiceWorkerGlobalScopeProxy> m_workerGlobalScopeProxy; 131 Persistent<ServiceWorkerGlobalScopeProxy> m_workerGlobalScopeProxy;
130 Persistent<WorkerInspectorProxy> m_workerInspectorProxy; 132 Persistent<WorkerInspectorProxy> m_workerInspectorProxy;
131 133
132 // 'shadow page' - created to proxy loading requests from the worker. 134 // 'shadow page' - created to proxy loading requests from the worker.
133 // Both WebView and WebFrame objects are close()'ed (where they're 135 // Both WebView and WebFrame objects are close()'ed (where they're
134 // deref'ed) when this EmbeddedWorkerImpl is destructed, therefore they 136 // deref'ed) when this EmbeddedWorkerImpl is destructed, therefore they
135 // are guaranteed to exist while this object is around. 137 // are guaranteed to exist while this object is around.
136 WebView* m_webView; 138 WebView* m_webView;
137 Persistent<WebLocalFrameImpl> m_mainFrame; 139
140 // Accessed cross-thread when worker thread posts tasks to the parent.
141 //
142 // TODO: avoid reaching into the local frame object when posting.
143 CrossThreadPersistent<WebLocalFrameImpl> m_mainFrame;
138 144
139 bool m_loadingShadowPage; 145 bool m_loadingShadowPage;
140 bool m_askedToTerminate; 146 bool m_askedToTerminate;
141 147
142 enum WaitingForDebuggerState { WaitingForDebugger, NotWaitingForDebugger }; 148 enum WaitingForDebuggerState { WaitingForDebugger, NotWaitingForDebugger };
143 149
144 enum { 150 enum {
145 DontPauseAfterDownload, 151 DontPauseAfterDownload,
146 DoPauseAfterDownload, 152 DoPauseAfterDownload,
147 IsPausedAfterDownload 153 IsPausedAfterDownload
148 } m_pauseAfterDownloadState; 154 } m_pauseAfterDownloadState;
149 155
150 WaitingForDebuggerState m_waitingForDebuggerState; 156 WaitingForDebuggerState m_waitingForDebuggerState;
151 }; 157 };
152 158
153 } // namespace blink 159 } // namespace blink
154 160
155 #endif // WebEmbeddedWorkerImpl_h 161 #endif // WebEmbeddedWorkerImpl_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Persistent.h ('k') | third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698