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

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

Issue 178663004: Oilpan: move WorkerGlobalScope to oilpan's heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove dead code Created 6 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 , m_timeOrigin(timeOrigin) 85 , m_timeOrigin(timeOrigin)
86 { 86 {
87 ScriptWrappable::init(this); 87 ScriptWrappable::init(this);
88 setClient(this); 88 setClient(this);
89 setSecurityOrigin(SecurityOrigin::create(url)); 89 setSecurityOrigin(SecurityOrigin::create(url));
90 m_workerClients->reattachThread(); 90 m_workerClients->reattachThread();
91 } 91 }
92 92
93 WorkerGlobalScope::~WorkerGlobalScope() 93 WorkerGlobalScope::~WorkerGlobalScope()
94 { 94 {
95 ASSERT(thread()->isCurrentThread()); 95 ASSERT(!m_thread);
96
97 // Notify proxy that we are going away. This can free the WorkerThread objec t, so do not access it after this.
98 thread()->workerReportingProxy().workerGlobalScopeDestroyed();
99
100 setClient(0);
101 } 96 }
102 97
103 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic y, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) 98 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic y, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
104 { 99 {
105 setContentSecurityPolicy(ContentSecurityPolicy::create(this)); 100 setContentSecurityPolicy(ContentSecurityPolicy::create(this));
106 contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType, ContentSecurityPolicy::HeaderSourceHTTP); 101 contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType, ContentSecurityPolicy::HeaderSourceHTTP);
107 } 102 }
108 103
109 ExecutionContext* WorkerGlobalScope::executionContext() const 104 ExecutionContext* WorkerGlobalScope::executionContext() const
110 { 105 {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 void WorkerGlobalScope::postTask(PassOwnPtr<ExecutionContextTask> task) 177 void WorkerGlobalScope::postTask(PassOwnPtr<ExecutionContextTask> task)
183 { 178 {
184 thread()->runLoop().postTask(task); 179 thread()->runLoop().postTask(task);
185 } 180 }
186 181
187 void WorkerGlobalScope::clearInspector() 182 void WorkerGlobalScope::clearInspector()
188 { 183 {
189 m_workerInspectorController.clear(); 184 m_workerInspectorController.clear();
190 } 185 }
191 186
187 void WorkerGlobalScope::detach()
Mads Ager (chromium) 2014/02/26 10:22:40 I really like this restructuring, thanks! :)
188 {
189 ASSERT(thread()->isCurrentThread());
190
191 // Notify proxy that we are going away. This can free the WorkerThread objec t, so do not access it after this.
192 thread()->workerReportingProxy().workerGlobalScopeDestroyed();
193
194 clearScript();
195 clearInspector();
196 setClient(0);
197 clearThread();
198 }
199
192 void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState & exceptionState) 200 void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState & exceptionState)
193 { 201 {
194 ASSERT(contentSecurityPolicy()); 202 ASSERT(contentSecurityPolicy());
195 Vector<String>::const_iterator urlsEnd = urls.end(); 203 Vector<String>::const_iterator urlsEnd = urls.end();
196 Vector<KURL> completedURLs; 204 Vector<KURL> completedURLs;
197 for (Vector<String>::const_iterator it = urls.begin(); it != urlsEnd; ++it) { 205 for (Vector<String>::const_iterator it = urls.begin(); it != urlsEnd; ++it) {
198 const KURL& url = executionContext()->completeURL(*it); 206 const KURL& url = executionContext()->completeURL(*it);
199 if (!url.isValid()) { 207 if (!url.isValid()) {
200 exceptionState.throwDOMException(SyntaxError, "The URL '" + *it + "' is invalid."); 208 exceptionState.throwDOMException(SyntaxError, "The URL '" + *it + "' is invalid.");
201 return; 209 return;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 bool WorkerGlobalScope::idleNotification() 281 bool WorkerGlobalScope::idleNotification()
274 { 282 {
275 return script()->idleNotification(); 283 return script()->idleNotification();
276 } 284 }
277 285
278 WorkerEventQueue* WorkerGlobalScope::eventQueue() const 286 WorkerEventQueue* WorkerGlobalScope::eventQueue() const
279 { 287 {
280 return m_eventQueue.get(); 288 return m_eventQueue.get();
281 } 289 }
282 290
291 void WorkerGlobalScope::trace(Visitor* visitor)
Mads Ager (chromium) 2014/02/26 10:22:40 Don't we need an explicit call to WorkerSupplement
sof 2014/02/26 12:25:13 Yes, thank you. This is a major oversight when add
292 {
293 visitor->trace(m_console);
294 visitor->trace(m_location);
295 visitor->trace(m_navigator);
296 }
297
283 } // namespace WebCore 298 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698