Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 class Blob; | 50 class Blob; |
| 51 class ExceptionState; | 51 class ExceptionState; |
| 52 class ScheduledAction; | 52 class ScheduledAction; |
| 53 class WorkerClients; | 53 class WorkerClients; |
| 54 class WorkerConsole; | 54 class WorkerConsole; |
| 55 class WorkerInspectorController; | 55 class WorkerInspectorController; |
| 56 class WorkerLocation; | 56 class WorkerLocation; |
| 57 class WorkerNavigator; | 57 class WorkerNavigator; |
| 58 class WorkerThread; | 58 class WorkerThread; |
| 59 | 59 |
| 60 class WorkerGlobalScope : public RefCounted<WorkerGlobalScope>, public Scrip tWrappable, public SecurityContext, public ExecutionContext, public ExecutionCon textClient, public WorkerSupplementable, public EventTargetWithInlineData { | 60 class WorkerGlobalScope : public RefCountedWillBeRefCountedGarbageCollected< WorkerGlobalScope>, public ScriptWrappable, public SecurityContext, public Execu tionContext, public ExecutionContextClient, public WorkerSupplementable, public EventTargetWithInlineData { |
|
sof
2014/02/24 22:46:24
Just noticed: we now need to address Supplementabl
haraken
2014/02/25 01:30:49
Just to help me understand: Why do we need to addr
sof
2014/02/25 08:56:35
The problem isn't that such Persistents won't be c
haraken
2014/02/25 11:16:28
Let me make sure that I'm understanding correctly:
sof
2014/02/25 11:38:02
Correct.
sof
2014/02/25 21:56:43
WorkerGlobalScope is now a GCed Supplementable alo
| |
| 61 REFCOUNTED_EVENT_TARGET(WorkerGlobalScope); | 61 DECLARE_GC_INFO; |
| 62 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollect ed<WorkerGlobalScope>); | |
| 62 public: | 63 public: |
| 63 virtual ~WorkerGlobalScope(); | 64 virtual ~WorkerGlobalScope(); |
| 64 | 65 |
| 65 virtual bool isWorkerGlobalScope() const OVERRIDE FINAL { return true; } | 66 virtual bool isWorkerGlobalScope() const OVERRIDE FINAL { return true; } |
| 66 | 67 |
| 67 virtual ExecutionContext* executionContext() const OVERRIDE FINAL; | 68 virtual ExecutionContext* executionContext() const OVERRIDE FINAL; |
| 68 | 69 |
| 69 virtual bool isSharedWorkerGlobalScope() const { return false; } | 70 virtual bool isSharedWorkerGlobalScope() const { return false; } |
| 70 virtual bool isDedicatedWorkerGlobalScope() const { return false; } | 71 virtual bool isDedicatedWorkerGlobalScope() const { return false; } |
| 71 virtual bool isServiceWorkerGlobalScope() const { return false; } | 72 virtual bool isServiceWorkerGlobalScope() const { return false; } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 | 117 |
| 117 bool idleNotification(); | 118 bool idleNotification(); |
| 118 | 119 |
| 119 double timeOrigin() const { return m_timeOrigin; } | 120 double timeOrigin() const { return m_timeOrigin; } |
| 120 | 121 |
| 121 WorkerClients* clients() { return m_workerClients.get(); } | 122 WorkerClients* clients() { return m_workerClients.get(); } |
| 122 | 123 |
| 123 using SecurityContext::securityOrigin; | 124 using SecurityContext::securityOrigin; |
| 124 using SecurityContext::contentSecurityPolicy; | 125 using SecurityContext::contentSecurityPolicy; |
| 125 | 126 |
| 127 virtual void trace(Visitor*); | |
| 128 | |
| 126 protected: | 129 protected: |
| 127 WorkerGlobalScope(const KURL&, const String& userAgent, WorkerThread*, d ouble timeOrigin, PassOwnPtr<WorkerClients>); | 130 WorkerGlobalScope(const KURL&, const String& userAgent, WorkerThread*, d ouble timeOrigin, PassOwnPtr<WorkerClients>); |
| 128 void applyContentSecurityPolicyFromString(const String& contentSecurityP olicy, ContentSecurityPolicy::HeaderType); | 131 void applyContentSecurityPolicyFromString(const String& contentSecurityP olicy, ContentSecurityPolicy::HeaderType); |
| 129 | 132 |
| 130 virtual void logExceptionToConsole(const String& errorMessage, const Str ing& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) O VERRIDE; | 133 virtual void logExceptionToConsole(const String& errorMessage, const Str ing& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) O VERRIDE; |
| 131 void addMessageToWorkerConsole(MessageSource, MessageLevel, const String & message, const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallSt ack>, ScriptState*); | 134 void addMessageToWorkerConsole(MessageSource, MessageLevel, const String & message, const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallSt ack>, ScriptState*); |
| 132 | 135 |
| 133 private: | 136 private: |
| 134 virtual void refExecutionContext() OVERRIDE FINAL { ref(); } | 137 virtual void refExecutionContext() OVERRIDE FINAL { ref(); } |
| 135 virtual void derefExecutionContext() OVERRIDE FINAL { deref(); } | 138 virtual void derefExecutionContext() OVERRIDE FINAL { deref(); } |
| 136 | 139 |
| 137 virtual const KURL& virtualURL() const OVERRIDE FINAL; | 140 virtual const KURL& virtualURL() const OVERRIDE FINAL; |
| 138 virtual KURL virtualCompleteURL(const String&) const OVERRIDE FINAL; | 141 virtual KURL virtualCompleteURL(const String&) const OVERRIDE FINAL; |
| 139 | 142 |
| 140 virtual void reportBlockedScriptExecutionToInspector(const String& direc tiveText) OVERRIDE FINAL; | 143 virtual void reportBlockedScriptExecutionToInspector(const String& direc tiveText) OVERRIDE FINAL; |
| 141 virtual void addMessage(MessageSource, MessageLevel, const String& messa ge, const String& sourceURL, unsigned lineNumber, ScriptState* = 0) OVERRIDE FIN AL; | 144 virtual void addMessage(MessageSource, MessageLevel, const String& messa ge, const String& sourceURL, unsigned lineNumber, ScriptState* = 0) OVERRIDE FIN AL; |
| 142 | 145 |
| 143 virtual EventTarget* errorEventTarget() OVERRIDE FINAL; | 146 virtual EventTarget* errorEventTarget() OVERRIDE FINAL; |
| 144 virtual void didUpdateSecurityOrigin() OVERRIDE FINAL { } | 147 virtual void didUpdateSecurityOrigin() OVERRIDE FINAL { } |
| 145 | 148 |
| 146 KURL m_url; | 149 KURL m_url; |
| 147 String m_userAgent; | 150 String m_userAgent; |
| 148 | 151 |
| 149 mutable RefPtr<WorkerConsole> m_console; | 152 mutable RefPtrWillBeMember<WorkerConsole> m_console; |
| 150 mutable RefPtr<WorkerLocation> m_location; | 153 mutable RefPtrWillBeMember<WorkerLocation> m_location; |
| 151 mutable RefPtr<WorkerNavigator> m_navigator; | 154 mutable RefPtrWillBeMember<WorkerNavigator> m_navigator; |
| 152 | 155 |
| 153 OwnPtr<WorkerScriptController> m_script; | 156 OwnPtr<WorkerScriptController> m_script; |
| 154 WorkerThread* m_thread; | 157 WorkerThread* m_thread; |
|
haraken
2014/02/25 01:30:49
This raw pointer will cause an issue.
- WorkerThr
sof
2014/02/25 07:46:44
If you look at WorkerThread::workerThread(), it as
Vyacheslav Egorov (Chromium)
2014/02/25 10:41:27
WorkerGlobalScope can't outlive the thread because
| |
| 155 | 158 |
| 156 OwnPtr<WorkerInspectorController> m_workerInspectorController; | 159 OwnPtr<WorkerInspectorController> m_workerInspectorController; |
| 157 bool m_closing; | 160 bool m_closing; |
| 158 | 161 |
| 159 HashSet<Observer*> m_workerObservers; | |
| 160 | |
| 161 OwnPtr<WorkerEventQueue> m_eventQueue; | 162 OwnPtr<WorkerEventQueue> m_eventQueue; |
| 162 | 163 |
| 163 OwnPtr<WorkerClients> m_workerClients; | 164 OwnPtr<WorkerClients> m_workerClients; |
| 164 | 165 |
| 165 double m_timeOrigin; | 166 double m_timeOrigin; |
| 166 }; | 167 }; |
| 167 | 168 |
| 168 DEFINE_TYPE_CASTS(WorkerGlobalScope, ExecutionContext, context, context->isWorke rGlobalScope(), context.isWorkerGlobalScope()); | 169 DEFINE_TYPE_CASTS(WorkerGlobalScope, ExecutionContext, context, context->isWorke rGlobalScope(), context.isWorkerGlobalScope()); |
| 169 | 170 |
| 170 } // namespace WebCore | 171 } // namespace WebCore |
| 171 | 172 |
| 172 #endif // WorkerGlobalScope_h | 173 #endif // WorkerGlobalScope_h |
| OLD | NEW |