Changeset 275611 in webkit


Ignore:
Timestamp:
Apr 7, 2021 10:08:35 AM (3 years ago)
Author:
Chris Dumez
Message:

Drop unnecessary NDEBUG checks in ServiceWorkerContainer
https://bugs.webkit.org/show_bug.cgi?id=224285

Reviewed by Youenn Fablet.

  • workers/service/ServiceWorkerContainer.cpp:

(WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
(WebCore::ServiceWorkerContainer::scheduleJob):
(WebCore::ServiceWorkerContainer::jobFailedWithException):
(WebCore::ServiceWorkerContainer::queueTaskToFireUpdateFoundEvent):
(WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
(WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
(WebCore::ServiceWorkerContainer::startScriptFetchForJob):
(WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
(WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
(WebCore::ServiceWorkerContainer::destroyJob):
(WebCore::ServiceWorkerContainer::addRegistration):
(WebCore::ServiceWorkerContainer::removeRegistration):
(WebCore::ServiceWorkerContainer::queueTaskToDispatchControllerChangeEvent):
(WebCore::ServiceWorkerContainer::contextIdentifier):

  • workers/service/ServiceWorkerContainer.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r275610 r275611  
     12021-04-07  Chris Dumez  <cdumez@apple.com>
     2
     3        Drop unnecessary NDEBUG checks in ServiceWorkerContainer
     4        https://bugs.webkit.org/show_bug.cgi?id=224285
     5
     6        Reviewed by Youenn Fablet.
     7
     8        * workers/service/ServiceWorkerContainer.cpp:
     9        (WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
     10        (WebCore::ServiceWorkerContainer::scheduleJob):
     11        (WebCore::ServiceWorkerContainer::jobFailedWithException):
     12        (WebCore::ServiceWorkerContainer::queueTaskToFireUpdateFoundEvent):
     13        (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
     14        (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
     15        (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
     16        (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
     17        (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
     18        (WebCore::ServiceWorkerContainer::destroyJob):
     19        (WebCore::ServiceWorkerContainer::addRegistration):
     20        (WebCore::ServiceWorkerContainer::removeRegistration):
     21        (WebCore::ServiceWorkerContainer::queueTaskToDispatchControllerChangeEvent):
     22        (WebCore::ServiceWorkerContainer::contextIdentifier):
     23        * workers/service/ServiceWorkerContainer.h:
     24
    1252021-04-07  Simon Fraser  <simon.fraser@apple.com>
    226
  • trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp

    r275465 r275611  
    8484ServiceWorkerContainer::~ServiceWorkerContainer()
    8585{
    86 #ifndef NDEBUG
    87     ASSERT(m_creationThread.ptr() == &Thread::current());
    88 #endif
     86    ASSERT(m_creationThread.ptr() == &Thread::current());
    8987}
    9088
     
    235233void ServiceWorkerContainer::scheduleJob(std::unique_ptr<ServiceWorkerJob>&& job)
    236234{
    237 #ifndef NDEBUG
    238     ASSERT(m_creationThread.ptr() == &Thread::current());
    239 #endif
    240 
     235    ASSERT(m_creationThread.ptr() == &Thread::current());
    241236    ASSERT(m_swConnection);
    242237    ASSERT(!isStopped());
     
    329324void ServiceWorkerContainer::jobFailedWithException(ServiceWorkerJob& job, const Exception& exception)
    330325{
    331 #ifndef NDEBUG
    332     ASSERT(m_creationThread.ptr() == &Thread::current());
    333 #endif
    334 
     326    ASSERT(m_creationThread.ptr() == &Thread::current());
    335327    ASSERT_WITH_MESSAGE(job.hasPromise() || job.data().type == ServiceWorkerJobType::Update, "Only soft updates have no promise");
    336328
     
    352344void ServiceWorkerContainer::queueTaskToFireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier identifier)
    353345{
    354 #ifndef NDEBUG
    355     ASSERT(m_creationThread.ptr() == &Thread::current());
    356 #endif
     346    ASSERT(m_creationThread.ptr() == &Thread::current());
    357347
    358348    if (auto* registration = m_registrations.get(identifier))
     
    362352void ServiceWorkerContainer::jobResolvedWithRegistration(ServiceWorkerJob& job, ServiceWorkerRegistrationData&& data, ShouldNotifyWhenResolved shouldNotifyWhenResolved)
    363353{
    364 #ifndef NDEBUG
    365     ASSERT(m_creationThread.ptr() == &Thread::current());
    366 #endif
     354    ASSERT(m_creationThread.ptr() == &Thread::current());
    367355    ASSERT_WITH_MESSAGE(job.hasPromise() || job.data().type == ServiceWorkerJobType::Update, "Only soft updates have no promise");
    368356
     
    433421void ServiceWorkerContainer::jobResolvedWithUnregistrationResult(ServiceWorkerJob& job, bool unregistrationResult)
    434422{
    435 #ifndef NDEBUG
    436     ASSERT(m_creationThread.ptr() == &Thread::current());
    437 #endif
    438 
     423    ASSERT(m_creationThread.ptr() == &Thread::current());
    439424    ASSERT(job.hasPromise());
    440425
     
    458443void ServiceWorkerContainer::startScriptFetchForJob(ServiceWorkerJob& job, FetchOptions::Cache cachePolicy)
    459444{
    460 #ifndef NDEBUG
    461     ASSERT(m_creationThread.ptr() == &Thread::current());
    462 #endif
     445    ASSERT(m_creationThread.ptr() == &Thread::current());
    463446
    464447    CONTAINER_RELEASE_LOG_IF_ALLOWED("startScriptFetchForJob: Starting script fetch for job %" PRIu64, job.identifier().toUInt64());
     
    477460void ServiceWorkerContainer::jobFinishedLoadingScript(ServiceWorkerJob& job, const ScriptBuffer& script, const CertificateInfo& certificateInfo, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicy, const String& referrerPolicy)
    478461{
    479 #ifndef NDEBUG
    480     ASSERT(m_creationThread.ptr() == &Thread::current());
    481 #endif
     462    ASSERT(m_creationThread.ptr() == &Thread::current());
    482463
    483464    CONTAINER_RELEASE_LOG_IF_ALLOWED("jobFinishedLoadingScript: Successfuly finished fetching script for job %" PRIu64, job.identifier().toUInt64());
     
    488469void ServiceWorkerContainer::jobFailedLoadingScript(ServiceWorkerJob& job, const ResourceError& error, Exception&& exception)
    489470{
    490 #ifndef NDEBUG
    491     ASSERT(m_creationThread.ptr() == &Thread::current());
    492 #endif
     471    ASSERT(m_creationThread.ptr() == &Thread::current());
    493472    ASSERT_WITH_MESSAGE(job.hasPromise() || job.data().type == ServiceWorkerJobType::Update, "Only soft updates have no promise");
    494473
     
    512491void ServiceWorkerContainer::destroyJob(ServiceWorkerJob& job)
    513492{
    514 #ifndef NDEBUG
    515     ASSERT(m_creationThread.ptr() == &Thread::current());
    516 #endif
    517 
     493    ASSERT(m_creationThread.ptr() == &Thread::current());
    518494    ASSERT(m_jobMap.contains(job.identifier()));
    519495    m_jobMap.remove(job.identifier());
     
    540516void ServiceWorkerContainer::addRegistration(ServiceWorkerRegistration& registration)
    541517{
    542 #ifndef NDEBUG
    543     ASSERT(m_creationThread.ptr() == &Thread::current());
    544 #endif
     518    ASSERT(m_creationThread.ptr() == &Thread::current());
    545519
    546520    ensureSWClientConnection().addServiceWorkerRegistrationInServer(registration.identifier());
     
    550524void ServiceWorkerContainer::removeRegistration(ServiceWorkerRegistration& registration)
    551525{
    552 #ifndef NDEBUG
    553     ASSERT(m_creationThread.ptr() == &Thread::current());
    554 #endif
     526    ASSERT(m_creationThread.ptr() == &Thread::current());
    555527
    556528    m_swConnection->removeServiceWorkerRegistrationInServer(registration.identifier());
     
    560532void ServiceWorkerContainer::queueTaskToDispatchControllerChangeEvent()
    561533{
    562 #ifndef NDEBUG
    563     ASSERT(m_creationThread.ptr() == &Thread::current());
    564 #endif
     534    ASSERT(m_creationThread.ptr() == &Thread::current());
    565535
    566536    queueTaskToDispatchEvent(*this, TaskSource::DOMManipulation, Event::create(eventNames().controllerchangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
     
    585555DocumentOrWorkerIdentifier ServiceWorkerContainer::contextIdentifier()
    586556{
    587 #ifndef NDEBUG
    588     ASSERT(m_creationThread.ptr() == &Thread::current());
    589 #endif
    590 
     557    ASSERT(m_creationThread.ptr() == &Thread::current());
    591558    ASSERT(scriptExecutionContext());
    592559    if (is<ServiceWorkerGlobalScope>(*scriptExecutionContext()))
  • trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h

    r275465 r275611  
    139139    HashMap<ServiceWorkerRegistrationIdentifier, ServiceWorkerRegistration*> m_registrations;
    140140
    141 #ifndef NDEBUG
     141#if ASSERT_ENABLED
    142142    Ref<Thread> m_creationThread { Thread::current() };
    143143#endif
Note: See TracChangeset for help on using the changeset viewer.