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

Side by Side Diff: third_party/WebKit/Source/core/workers/WorkerGlobalScope.h

Issue 2171563002: Add WorkerSettings to expose certain flag values in WorkerGlobalScope (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 4 years, 4 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) 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 22 matching lines...) Expand all
33 #include "core/dom/ExecutionContext.h" 33 #include "core/dom/ExecutionContext.h"
34 #include "core/events/EventListener.h" 34 #include "core/events/EventListener.h"
35 #include "core/events/EventTarget.h" 35 #include "core/events/EventTarget.h"
36 #include "core/fetch/CachedMetadataHandler.h" 36 #include "core/fetch/CachedMetadataHandler.h"
37 #include "core/frame/DOMTimerCoordinator.h" 37 #include "core/frame/DOMTimerCoordinator.h"
38 #include "core/frame/DOMWindowBase64.h" 38 #include "core/frame/DOMWindowBase64.h"
39 #include "core/frame/UseCounter.h" 39 #include "core/frame/UseCounter.h"
40 #include "core/frame/csp/ContentSecurityPolicy.h" 40 #include "core/frame/csp/ContentSecurityPolicy.h"
41 #include "core/workers/WorkerEventQueue.h" 41 #include "core/workers/WorkerEventQueue.h"
42 #include "core/workers/WorkerOrWorkletGlobalScope.h" 42 #include "core/workers/WorkerOrWorkletGlobalScope.h"
43 #include "core/workers/WorkerSettings.h"
43 #include "platform/heap/Handle.h" 44 #include "platform/heap/Handle.h"
44 #include "wtf/ListHashSet.h" 45 #include "wtf/ListHashSet.h"
45 #include <memory> 46 #include <memory>
46 47
47 namespace blink { 48 namespace blink {
48 49
49 class ConsoleMessage; 50 class ConsoleMessage;
50 class ConsoleMessageStorage; 51 class ConsoleMessageStorage;
51 class ExceptionState; 52 class ExceptionState;
52 class V8AbstractEventListener; 53 class V8AbstractEventListener;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 122
122 // Returns true when the WorkerGlobalScope is closing (e.g. via close() 123 // Returns true when the WorkerGlobalScope is closing (e.g. via close()
123 // method). If this returns true, the worker is going to be shutdown after 124 // method). If this returns true, the worker is going to be shutdown after
124 // the current task execution. Workers that don't support close operation 125 // the current task execution. Workers that don't support close operation
125 // should always return false. 126 // should always return false.
126 bool isClosing() const { return m_closing; } 127 bool isClosing() const { return m_closing; }
127 128
128 const KURL& url() const { return m_url; } 129 const KURL& url() const { return m_url; }
129 WorkerThread* thread() const { return m_thread; } 130 WorkerThread* thread() const { return m_thread; }
130 double timeOrigin() const { return m_timeOrigin; } 131 double timeOrigin() const { return m_timeOrigin; }
132 WorkerSettings* workerSettings() const { return m_workerSettings.get(); }
131 133
132 WorkerOrWorkletScriptController* scriptController() final { return m_scriptC ontroller.get(); } 134 WorkerOrWorkletScriptController* scriptController() final { return m_scriptC ontroller.get(); }
133 WorkerInspectorController* workerInspectorController() { return m_workerInsp ectorController.get(); } 135 WorkerInspectorController* workerInspectorController() { return m_workerInsp ectorController.get(); }
134 WorkerClients* clients() { return m_workerClients.get(); } 136 WorkerClients* clients() { return m_workerClients.get(); }
135 ConsoleMessageStorage* consoleMessageStorage() { return m_consoleMessageStor age.get(); } 137 ConsoleMessageStorage* consoleMessageStorage() { return m_consoleMessageStor age.get(); }
136 138
137 DECLARE_VIRTUAL_TRACE(); 139 DECLARE_VIRTUAL_TRACE();
138 140
139 protected: 141 protected:
140 WorkerGlobalScope(const KURL&, const String& userAgent, WorkerThread*, doubl e timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData>, WorkerClients*); 142 WorkerGlobalScope(const KURL&, const String& userAgent, WorkerThread*, doubl e timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData>, WorkerClients*);
143 void setWorkerSettings(std::unique_ptr<WorkerSettings>);
141 void applyContentSecurityPolicyFromVector(const Vector<CSPHeaderAndType>& he aders); 144 void applyContentSecurityPolicyFromVector(const Vector<CSPHeaderAndType>& he aders);
142 145
143 void addMessageToWorkerConsole(ConsoleMessage*); 146 void addMessageToWorkerConsole(ConsoleMessage*);
144 void setV8CacheOptions(V8CacheOptions v8CacheOptions) { m_v8CacheOptions = v 8CacheOptions; } 147 void setV8CacheOptions(V8CacheOptions v8CacheOptions) { m_v8CacheOptions = v 8CacheOptions; }
145 148
146 // ExecutionContext 149 // ExecutionContext
147 void exceptionThrown(const String& errorMessage, std::unique_ptr<SourceLocat ion>) override; 150 void exceptionThrown(const String& errorMessage, std::unique_ptr<SourceLocat ion>) override;
148 void removeURLFromMemoryCache(const KURL&) final; 151 void removeURLFromMemoryCache(const KURL&) final;
149 152
150 private: 153 private:
151 // ExecutionContext 154 // ExecutionContext
152 EventTarget* errorEventTarget() final { return this; } 155 EventTarget* errorEventTarget() final { return this; }
153 const KURL& virtualURL() const final { return m_url; } 156 const KURL& virtualURL() const final { return m_url; }
154 KURL virtualCompleteURL(const String&) const final; 157 KURL virtualCompleteURL(const String&) const final;
155 158
156 // SecurityContext 159 // SecurityContext
157 void didUpdateSecurityOrigin() final {} 160 void didUpdateSecurityOrigin() final {}
158 161
159 void clearScript(); 162 void clearScript();
160 void clearInspector(); 163 void clearInspector();
161 164
162 const KURL m_url; 165 const KURL m_url;
163 const String m_userAgent; 166 const String m_userAgent;
164 V8CacheOptions m_v8CacheOptions; 167 V8CacheOptions m_v8CacheOptions;
168 std::unique_ptr<WorkerSettings> m_workerSettings;
165 169
166 mutable Member<WorkerLocation> m_location; 170 mutable Member<WorkerLocation> m_location;
167 mutable Member<WorkerNavigator> m_navigator; 171 mutable Member<WorkerNavigator> m_navigator;
168 172
169 mutable UseCounter::CountBits m_deprecationWarningBits; 173 mutable UseCounter::CountBits m_deprecationWarningBits;
170 174
171 Member<WorkerOrWorkletScriptController> m_scriptController; 175 Member<WorkerOrWorkletScriptController> m_scriptController;
172 WorkerThread* m_thread; 176 WorkerThread* m_thread;
173 177
174 Member<WorkerInspectorController> m_workerInspectorController; 178 Member<WorkerInspectorController> m_workerInspectorController;
(...skipping 10 matching lines...) Expand all
185 Member<ConsoleMessageStorage> m_consoleMessageStorage; 189 Member<ConsoleMessageStorage> m_consoleMessageStorage;
186 190
187 HeapListHashSet<Member<V8AbstractEventListener>> m_eventListeners; 191 HeapListHashSet<Member<V8AbstractEventListener>> m_eventListeners;
188 }; 192 };
189 193
190 DEFINE_TYPE_CASTS(WorkerGlobalScope, ExecutionContext, context, context->isWorke rGlobalScope(), context.isWorkerGlobalScope()); 194 DEFINE_TYPE_CASTS(WorkerGlobalScope, ExecutionContext, context, context->isWorke rGlobalScope(), context.isWorkerGlobalScope());
191 195
192 } // namespace blink 196 } // namespace blink
193 197
194 #endif // WorkerGlobalScope_h 198 #endif // WorkerGlobalScope_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698