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

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

Issue 178663004: Oilpan: move WorkerGlobalScope to oilpan's heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 9 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 18 matching lines...) Expand all
29 29
30 #include "bindings/v8/ScriptWrappable.h" 30 #include "bindings/v8/ScriptWrappable.h"
31 #include "bindings/v8/WorkerScriptController.h" 31 #include "bindings/v8/WorkerScriptController.h"
32 #include "core/dom/ExecutionContext.h" 32 #include "core/dom/ExecutionContext.h"
33 #include "core/events/EventListener.h" 33 #include "core/events/EventListener.h"
34 #include "core/events/EventTarget.h" 34 #include "core/events/EventTarget.h"
35 #include "core/events/ThreadLocalEventNames.h" 35 #include "core/events/ThreadLocalEventNames.h"
36 #include "core/frame/ContentSecurityPolicy.h" 36 #include "core/frame/ContentSecurityPolicy.h"
37 #include "core/workers/WorkerConsole.h" 37 #include "core/workers/WorkerConsole.h"
38 #include "core/workers/WorkerEventQueue.h" 38 #include "core/workers/WorkerEventQueue.h"
39 #include "core/workers/WorkerSupplementable.h"
40 #include "wtf/Assertions.h" 39 #include "wtf/Assertions.h"
41 #include "wtf/HashMap.h" 40 #include "wtf/HashMap.h"
42 #include "wtf/OwnPtr.h" 41 #include "wtf/OwnPtr.h"
43 #include "wtf/PassRefPtr.h" 42 #include "wtf/PassRefPtr.h"
44 #include "wtf/RefCounted.h" 43 #include "wtf/RefCounted.h"
45 #include "wtf/RefPtr.h" 44 #include "wtf/RefPtr.h"
46 #include "wtf/text/AtomicStringHash.h" 45 #include "wtf/text/AtomicStringHash.h"
47 46
48 namespace WebCore { 47 namespace WebCore {
49 48
50 class Blob; 49 class Blob;
51 class ExceptionState; 50 class ExceptionState;
52 class ScheduledAction; 51 class ScheduledAction;
53 class WorkerClients; 52 class WorkerClients;
54 class WorkerConsole; 53 class WorkerConsole;
55 class WorkerInspectorController; 54 class WorkerInspectorController;
56 class WorkerLocation; 55 class WorkerLocation;
57 class WorkerNavigator; 56 class WorkerNavigator;
58 class WorkerThread; 57 class WorkerThread;
59 58
60 class WorkerGlobalScope : public RefCounted<WorkerGlobalScope>, public Scrip tWrappable, public SecurityContext, public ExecutionContext, public ExecutionCon textClient, public WorkerSupplementable, public EventTargetWithInlineData { 59 class WorkerGlobalScope : public RefCountedWillBeRefCountedGarbageCollected< WorkerGlobalScope>, public ScriptWrappable, public SecurityContext, public Execu tionContext, public ExecutionContextClient, public WillBeHeapSupplementable<Work erGlobalScope>, public EventTargetWithInlineData {
61 REFCOUNTED_EVENT_TARGET(WorkerGlobalScope); 60 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollect ed<WorkerGlobalScope>);
62 public: 61 public:
63 virtual ~WorkerGlobalScope(); 62 virtual ~WorkerGlobalScope();
64 63
65 virtual bool isWorkerGlobalScope() const OVERRIDE FINAL { return true; } 64 virtual bool isWorkerGlobalScope() const OVERRIDE FINAL { return true; }
66 65
67 virtual ExecutionContext* executionContext() const OVERRIDE FINAL; 66 virtual ExecutionContext* executionContext() const OVERRIDE FINAL;
68 67
69 virtual bool isSharedWorkerGlobalScope() const { return false; } 68 virtual bool isSharedWorkerGlobalScope() const { return false; }
70 virtual bool isDedicatedWorkerGlobalScope() const { return false; } 69 virtual bool isDedicatedWorkerGlobalScope() const { return false; }
71 virtual bool isServiceWorkerGlobalScope() const { return false; } 70 virtual bool isServiceWorkerGlobalScope() const { return false; }
72 71
73 const KURL& url() const { return m_url; } 72 const KURL& url() const { return m_url; }
74 KURL completeURL(const String&) const; 73 KURL completeURL(const String&) const;
75 74
76 virtual String userAgent(const KURL&) const OVERRIDE FINAL; 75 virtual String userAgent(const KURL&) const OVERRIDE FINAL;
77 virtual void disableEval(const String& errorMessage) OVERRIDE FINAL; 76 virtual void disableEval(const String& errorMessage) OVERRIDE FINAL;
78 77
79 WorkerScriptController* script() { return m_script.get(); } 78 WorkerScriptController* script() { return m_script.get(); }
80 void clearScript() { m_script.clear(); } 79 void clearScript() { m_script.clear(); }
81 void clearInspector(); 80 void clearInspector();
82 81
82 void detach();
haraken 2014/03/03 12:55:50 (I'm sorry I suggested "detach" but) we normally c
sof 2014/03/04 08:18:00 dispose() it is.
83
83 WorkerThread* thread() const { return m_thread; } 84 WorkerThread* thread() const { return m_thread; }
84 85
85 virtual void postTask(PassOwnPtr<ExecutionContextTask>) OVERRIDE FINAL; // Executes the task on context's thread asynchronously. 86 virtual void postTask(PassOwnPtr<ExecutionContextTask>) OVERRIDE FINAL; // Executes the task on context's thread asynchronously.
86 87
87 // WorkerGlobalScope 88 // WorkerGlobalScope
88 WorkerGlobalScope* self() { return this; } 89 WorkerGlobalScope* self() { return this; }
89 WorkerConsole* console(); 90 WorkerConsole* console();
90 WorkerLocation* location() const; 91 WorkerLocation* location() const;
91 void close(); 92 void close();
92 93
(...skipping 23 matching lines...) Expand all
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;
155 158
156 OwnPtr<WorkerInspectorController> m_workerInspectorController; 159 OwnPtr<WorkerInspectorController> m_workerInspectorController;
157 bool m_closing; 160 bool m_closing;
158 161
159 OwnPtr<WorkerEventQueue> m_eventQueue; 162 OwnPtr<WorkerEventQueue> m_eventQueue;
160 163
161 OwnPtr<WorkerClients> m_workerClients; 164 OwnPtr<WorkerClients> m_workerClients;
162 165
163 double m_timeOrigin; 166 double m_timeOrigin;
164 }; 167 };
165 168
166 DEFINE_TYPE_CASTS(WorkerGlobalScope, ExecutionContext, context, context->isWorke rGlobalScope(), context.isWorkerGlobalScope()); 169 DEFINE_TYPE_CASTS(WorkerGlobalScope, ExecutionContext, context, context->isWorke rGlobalScope(), context.isWorkerGlobalScope());
167 170
168 } // namespace WebCore 171 } // namespace WebCore
169 172
170 #endif // WorkerGlobalScope_h 173 #endif // WorkerGlobalScope_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698