| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "modules/serviceworkers/ExtendableEvent.h" | 54 #include "modules/serviceworkers/ExtendableEvent.h" |
| 55 #include "modules/serviceworkers/ExtendableMessageEvent.h" | 55 #include "modules/serviceworkers/ExtendableMessageEvent.h" |
| 56 #include "modules/serviceworkers/FetchEvent.h" | 56 #include "modules/serviceworkers/FetchEvent.h" |
| 57 #include "modules/serviceworkers/ForeignFetchEvent.h" | 57 #include "modules/serviceworkers/ForeignFetchEvent.h" |
| 58 #include "modules/serviceworkers/InstallEvent.h" | 58 #include "modules/serviceworkers/InstallEvent.h" |
| 59 #include "modules/serviceworkers/ServiceWorkerClient.h" | 59 #include "modules/serviceworkers/ServiceWorkerClient.h" |
| 60 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" | 60 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" |
| 61 #include "modules/serviceworkers/ServiceWorkerWindowClient.h" | 61 #include "modules/serviceworkers/ServiceWorkerWindowClient.h" |
| 62 #include "modules/serviceworkers/WaitUntilObserver.h" | 62 #include "modules/serviceworkers/WaitUntilObserver.h" |
| 63 #include "platform/RuntimeEnabledFeatures.h" | 63 #include "platform/RuntimeEnabledFeatures.h" |
| 64 #include "platform/WebFrameScheduler.h" |
| 64 #include "public/platform/modules/notifications/WebNotificationData.h" | 65 #include "public/platform/modules/notifications/WebNotificationData.h" |
| 65 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h" | 66 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h" |
| 66 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" | 67 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" |
| 67 #include "public/web/WebSerializedScriptValue.h" | 68 #include "public/web/WebSerializedScriptValue.h" |
| 68 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" | 69 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" |
| 69 #include "web/WebEmbeddedWorkerImpl.h" | 70 #include "web/WebEmbeddedWorkerImpl.h" |
| 70 #include "wtf/Assertions.h" | 71 #include "wtf/Assertions.h" |
| 71 #include "wtf/Functional.h" | 72 #include "wtf/Functional.h" |
| 72 #include "wtf/PtrUtil.h" | 73 #include "wtf/PtrUtil.h" |
| 73 #include <memory> | 74 #include <memory> |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 : m_embeddedWorker(&embeddedWorker), | 462 : m_embeddedWorker(&embeddedWorker), |
| 462 m_document(&document), | 463 m_document(&document), |
| 463 m_client(&client), | 464 m_client(&client), |
| 464 m_workerGlobalScope(nullptr) { | 465 m_workerGlobalScope(nullptr) { |
| 465 // ServiceWorker can sometimes run tasks that are initiated by/associated with | 466 // ServiceWorker can sometimes run tasks that are initiated by/associated with |
| 466 // a document's frame but these documents can be from a different process. So | 467 // a document's frame but these documents can be from a different process. So |
| 467 // we intentionally populate the task runners with null document in order to | 468 // we intentionally populate the task runners with null document in order to |
| 468 // use the thread's default task runner. Note that |m_document| should not be | 469 // use the thread's default task runner. Note that |m_document| should not be |
| 469 // used as it's a dummy document for loading that doesn't represent the frame | 470 // used as it's a dummy document for loading that doesn't represent the frame |
| 470 // of any associated document. | 471 // of any associated document. |
| 471 m_parentFrameTaskRunners = ParentFrameTaskRunners::create(nullptr); | 472 m_parentFrameTaskRunners = ParentFrameTaskRunners::create(document.frame()); |
| 473 document.frame()->frameScheduler()->setMaximumPriorityForLabTest(); |
| 472 } | 474 } |
| 473 | 475 |
| 474 void ServiceWorkerGlobalScopeProxy::detach() { | 476 void ServiceWorkerGlobalScopeProxy::detach() { |
| 475 m_embeddedWorker = nullptr; | 477 m_embeddedWorker = nullptr; |
| 476 m_document = nullptr; | 478 m_document = nullptr; |
| 477 m_client = nullptr; | 479 m_client = nullptr; |
| 478 m_workerGlobalScope = nullptr; | 480 m_workerGlobalScope = nullptr; |
| 479 } | 481 } |
| 480 | 482 |
| 481 WebServiceWorkerContextClient& ServiceWorkerGlobalScopeProxy::client() const { | 483 WebServiceWorkerContextClient& ServiceWorkerGlobalScopeProxy::client() const { |
| 482 DCHECK(m_client); | 484 DCHECK(m_client); |
| 483 return *m_client; | 485 return *m_client; |
| 484 } | 486 } |
| 485 | 487 |
| 486 Document& ServiceWorkerGlobalScopeProxy::document() const { | 488 Document& ServiceWorkerGlobalScopeProxy::document() const { |
| 487 DCHECK(m_document); | 489 DCHECK(m_document); |
| 488 return *m_document; | 490 return *m_document; |
| 489 } | 491 } |
| 490 | 492 |
| 491 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() | 493 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() |
| 492 const { | 494 const { |
| 493 DCHECK(m_workerGlobalScope); | 495 DCHECK(m_workerGlobalScope); |
| 494 return m_workerGlobalScope; | 496 return m_workerGlobalScope; |
| 495 } | 497 } |
| 496 | 498 |
| 497 } // namespace blink | 499 } // namespace blink |
| OLD | NEW |