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

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

Issue 1190133002: Remove WorkerScriptLoaderClient and inheritances (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review #6 and #7 Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/workers/InProcessWorkerBase.cpp ('k') | Source/core/workers/WorkerScriptLoader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 return; 234 return;
235 } 235 }
236 if (!contentSecurityPolicy()->allowScriptFromSource(url)) { 236 if (!contentSecurityPolicy()->allowScriptFromSource(url)) {
237 exceptionState.throwDOMException(NetworkError, "The script at '" + u rl.elidedString() + "' failed to load."); 237 exceptionState.throwDOMException(NetworkError, "The script at '" + u rl.elidedString() + "' failed to load.");
238 return; 238 return;
239 } 239 }
240 completedURLs.append(url); 240 completedURLs.append(url);
241 } 241 }
242 242
243 for (const KURL& completeURL : completedURLs) { 243 for (const KURL& completeURL : completedURLs) {
244 RefPtr<WorkerScriptLoader> scriptLoader(WorkerScriptLoader::create()); 244 WorkerScriptLoader scriptLoader;
245 scriptLoader->setRequestContext(WebURLRequest::RequestContextScript); 245 scriptLoader.setRequestContext(WebURLRequest::RequestContextScript);
246 scriptLoader->loadSynchronously(executionContext, completeURL, AllowCros sOriginRequests); 246 scriptLoader.loadSynchronously(executionContext, completeURL, AllowCross OriginRequests);
247 247
248 // If the fetching attempt failed, throw a NetworkError exception and ab ort all these steps. 248 // If the fetching attempt failed, throw a NetworkError exception and ab ort all these steps.
249 if (scriptLoader->failed()) { 249 if (scriptLoader.failed()) {
250 exceptionState.throwDOMException(NetworkError, "The script at '" + c ompleteURL.elidedString() + "' failed to load."); 250 exceptionState.throwDOMException(NetworkError, "The script at '" + c ompleteURL.elidedString() + "' failed to load.");
251 return; 251 return;
252 } 252 }
253 253
254 InspectorInstrumentation::scriptImported(&executionContext, scriptLoader ->identifier(), scriptLoader->script()); 254 InspectorInstrumentation::scriptImported(&executionContext, scriptLoader .identifier(), scriptLoader.script());
255 scriptLoaded(scriptLoader->script().length(), scriptLoader->cachedMetada ta() ? scriptLoader->cachedMetadata()->size() : 0); 255 scriptLoaded(scriptLoader.script().length(), scriptLoader.cachedMetadata () ? scriptLoader.cachedMetadata()->size() : 0);
256 256
257 RefPtrWillBeRawPtr<ErrorEvent> errorEvent = nullptr; 257 RefPtrWillBeRawPtr<ErrorEvent> errorEvent = nullptr;
258 OwnPtr<Vector<char>> cachedMetaData(scriptLoader->releaseCachedMetadata( )); 258 OwnPtr<Vector<char>> cachedMetaData(scriptLoader.releaseCachedMetadata() );
259 OwnPtr<CachedMetadataHandler> handler(createWorkerScriptCachedMetadataHa ndler(completeURL, cachedMetaData.get())); 259 OwnPtr<CachedMetadataHandler> handler(createWorkerScriptCachedMetadataHa ndler(completeURL, cachedMetaData.get()));
260 m_script->evaluate(ScriptSourceCode(scriptLoader->script(), scriptLoader ->responseURL()), &errorEvent, handler.get(), m_v8CacheOptions); 260 m_script->evaluate(ScriptSourceCode(scriptLoader.script(), scriptLoader. responseURL()), &errorEvent, handler.get(), m_v8CacheOptions);
261 if (errorEvent) { 261 if (errorEvent) {
262 m_script->rethrowExceptionFromImportedScript(errorEvent.release(), e xceptionState); 262 m_script->rethrowExceptionFromImportedScript(errorEvent.release(), e xceptionState);
263 return; 263 return;
264 } 264 }
265 } 265 }
266 } 266 }
267 267
268 EventTarget* WorkerGlobalScope::errorEventTarget() 268 EventTarget* WorkerGlobalScope::errorEventTarget()
269 { 269 {
270 return this; 270 return this;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 visitor->trace(m_timers); 396 visitor->trace(m_timers);
397 visitor->trace(m_messageStorage); 397 visitor->trace(m_messageStorage);
398 visitor->trace(m_pendingMessages); 398 visitor->trace(m_pendingMessages);
399 HeapSupplementable<WorkerGlobalScope>::trace(visitor); 399 HeapSupplementable<WorkerGlobalScope>::trace(visitor);
400 #endif 400 #endif
401 ExecutionContext::trace(visitor); 401 ExecutionContext::trace(visitor);
402 EventTargetWithInlineData::trace(visitor); 402 EventTargetWithInlineData::trace(visitor);
403 } 403 }
404 404
405 } // namespace blink 405 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/workers/InProcessWorkerBase.cpp ('k') | Source/core/workers/WorkerScriptLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698