| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 WebContentSecurityPolicyType policyType, | 346 WebContentSecurityPolicyType policyType, |
| 347 WebAddressSpace creationAddressSpace) { | 347 WebAddressSpace creationAddressSpace) { |
| 348 m_url = url; | 348 m_url = url; |
| 349 m_name = name; | 349 m_name = name; |
| 350 m_creationAddressSpace = creationAddressSpace; | 350 m_creationAddressSpace = creationAddressSpace; |
| 351 initializeLoader(); | 351 initializeLoader(); |
| 352 } | 352 } |
| 353 | 353 |
| 354 void WebSharedWorkerImpl::didReceiveScriptLoaderResponse() { | 354 void WebSharedWorkerImpl::didReceiveScriptLoaderResponse() { |
| 355 InspectorInstrumentation::didReceiveScriptResponse( | 355 InspectorInstrumentation::didReceiveScriptResponse( |
| 356 m_loadingDocument.get(), m_mainScriptLoader->identifier()); | 356 m_loadingDocument, m_mainScriptLoader->identifier()); |
| 357 m_client->selectAppCacheID(m_mainScriptLoader->appCacheID()); | 357 m_client->selectAppCacheID(m_mainScriptLoader->appCacheID()); |
| 358 } | 358 } |
| 359 | 359 |
| 360 void WebSharedWorkerImpl::onScriptLoaderFinished() { | 360 void WebSharedWorkerImpl::onScriptLoaderFinished() { |
| 361 DCHECK(m_loadingDocument); | 361 DCHECK(m_loadingDocument); |
| 362 DCHECK(m_mainScriptLoader); | 362 DCHECK(m_mainScriptLoader); |
| 363 if (m_askedToTerminate) | 363 if (m_askedToTerminate) |
| 364 return; | 364 return; |
| 365 if (m_mainScriptLoader->failed()) { | 365 if (m_mainScriptLoader->failed()) { |
| 366 m_mainScriptLoader->cancel(); | 366 m_mainScriptLoader->cancel(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 // a document's frame but these documents can be from a different process. So | 408 // a document's frame but these documents can be from a different process. So |
| 409 // we intentionally populate the task runners with null document in order to | 409 // we intentionally populate the task runners with null document in order to |
| 410 // use the thread's default task runner. Note that |m_document| should not be | 410 // use the thread's default task runner. Note that |m_document| should not be |
| 411 // used as it's a dummy document for loading that doesn't represent the frame | 411 // used as it's a dummy document for loading that doesn't represent the frame |
| 412 // of any associated document. | 412 // of any associated document. |
| 413 m_parentFrameTaskRunners = ParentFrameTaskRunners::create(nullptr); | 413 m_parentFrameTaskRunners = ParentFrameTaskRunners::create(nullptr); |
| 414 | 414 |
| 415 m_loaderProxy = WorkerLoaderProxy::create(this); | 415 m_loaderProxy = WorkerLoaderProxy::create(this); |
| 416 m_workerThread = SharedWorkerThread::create(m_name, m_loaderProxy, *this, | 416 m_workerThread = SharedWorkerThread::create(m_name, m_loaderProxy, *this, |
| 417 m_parentFrameTaskRunners.get()); | 417 m_parentFrameTaskRunners.get()); |
| 418 InspectorInstrumentation::scriptImported(m_loadingDocument.get(), | 418 InspectorInstrumentation::scriptImported(m_loadingDocument, |
| 419 m_mainScriptLoader->identifier(), | 419 m_mainScriptLoader->identifier(), |
| 420 m_mainScriptLoader->script()); | 420 m_mainScriptLoader->script()); |
| 421 m_mainScriptLoader.clear(); | 421 m_mainScriptLoader.clear(); |
| 422 | 422 |
| 423 workerThread()->start(std::move(startupData)); | 423 workerThread()->start(std::move(startupData)); |
| 424 m_workerInspectorProxy->workerThreadCreated( | 424 m_workerInspectorProxy->workerThreadCreated(toDocument(m_loadingDocument), |
| 425 toDocument(m_loadingDocument.get()), workerThread(), m_url); | 425 workerThread(), m_url); |
| 426 m_client->workerScriptLoaded(); | 426 m_client->workerScriptLoaded(); |
| 427 } | 427 } |
| 428 | 428 |
| 429 void WebSharedWorkerImpl::terminateWorkerContext() { | 429 void WebSharedWorkerImpl::terminateWorkerContext() { |
| 430 terminateWorkerThread(); | 430 terminateWorkerThread(); |
| 431 } | 431 } |
| 432 | 432 |
| 433 void WebSharedWorkerImpl::pauseWorkerContextOnStart() { | 433 void WebSharedWorkerImpl::pauseWorkerContextOnStart() { |
| 434 m_pauseWorkerContextOnStart = true; | 434 m_pauseWorkerContextOnStart = true; |
| 435 } | 435 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 466 if (devtoolsAgent) | 466 if (devtoolsAgent) |
| 467 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method, | 467 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method, |
| 468 message); | 468 message); |
| 469 } | 469 } |
| 470 | 470 |
| 471 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) { | 471 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) { |
| 472 return new WebSharedWorkerImpl(client); | 472 return new WebSharedWorkerImpl(client); |
| 473 } | 473 } |
| 474 | 474 |
| 475 } // namespace blink | 475 } // namespace blink |
| OLD | NEW |