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

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: 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 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());
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 } 95 }
102 96
103 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic y, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) 97 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic y, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
104 { 98 {
105 setContentSecurityPolicy(ContentSecurityPolicy::create(this)); 99 setContentSecurityPolicy(ContentSecurityPolicy::create(this));
106 contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType, ContentSecurityPolicy::HeaderSourceHTTP); 100 contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType, ContentSecurityPolicy::HeaderSourceHTTP);
107 } 101 }
108 102
109 ExecutionContext* WorkerGlobalScope::executionContext() const 103 ExecutionContext* WorkerGlobalScope::executionContext() const
110 { 104 {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 void WorkerGlobalScope::postTask(PassOwnPtr<ExecutionContextTask> task) 176 void WorkerGlobalScope::postTask(PassOwnPtr<ExecutionContextTask> task)
183 { 177 {
184 thread()->runLoop().postTask(task); 178 thread()->runLoop().postTask(task);
185 } 179 }
186 180
187 void WorkerGlobalScope::clearInspector() 181 void WorkerGlobalScope::clearInspector()
188 { 182 {
189 m_workerInspectorController.clear(); 183 m_workerInspectorController.clear();
190 } 184 }
191 185
186 void WorkerGlobalScope::detach()
187 {
188 ASSERT(thread()->isCurrentThread());
189
190 // Notify proxy that we are going away. This can free the WorkerThread objec t, so do not access it after this.
191 thread()->workerReportingProxy().workerGlobalScopeDestroyed();
192
193 clearScript();
194 clearInspector();
195 setClient(0);
196 // NOTE: the thread reference isn't cleared, as the execution context's
197 // thread is accessed by other GCed objects being finalized/destructed.
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)
292 {
293 visitor->trace(m_console);
294 visitor->trace(m_location);
295 visitor->trace(m_navigator);
296 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor);
297 }
298
283 } // namespace WebCore 299 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698