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

Side by Side Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 650033007: ServiceWorker: Make a way to retrieve a service worker version id (Blink) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: change assert Created 6 years, 1 month 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
« no previous file with comments | « Source/core/fetch/ResourceFetcher.h ('k') | Source/core/loader/EmptyClients.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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 bool ResourceFetcher::isControlledByServiceWorker() const 617 bool ResourceFetcher::isControlledByServiceWorker() const
618 { 618 {
619 LocalFrame* localFrame = frame(); 619 LocalFrame* localFrame = frame();
620 if (!localFrame) 620 if (!localFrame)
621 return false; 621 return false;
622 if (!m_documentLoader) 622 if (!m_documentLoader)
623 return false; 623 return false;
624 return localFrame->loader().client()->isControlledByServiceWorker(*m_documen tLoader); 624 return localFrame->loader().client()->isControlledByServiceWorker(*m_documen tLoader);
625 } 625 }
626 626
627 int64_t ResourceFetcher::serviceWorkerID() const
628 {
629 LocalFrame* localFrame = frame();
630 if (!localFrame)
631 return -1;
632 ASSERT(m_documentLoader || localFrame->loader().documentLoader());
633 if (m_documentLoader)
634 return localFrame->loader().client()->serviceWorkerID(*m_documentLoader) ;
635 // m_documentLoader is null while loading resources from the imported HTML.
636 // In such cases a service worker ID could be retrieved from the document
637 // loader of the frame.
638 return localFrame->loader().client()->serviceWorkerID(*localFrame->loader(). documentLoader());
639 }
640
627 bool ResourceFetcher::shouldLoadNewResource(Resource::Type type) const 641 bool ResourceFetcher::shouldLoadNewResource(Resource::Type type) const
628 { 642 {
629 if (!frame()) 643 if (!frame())
630 return false; 644 return false;
631 if (!m_documentLoader) 645 if (!m_documentLoader)
632 return true; 646 return true;
633 if (type == Resource::MainResource) 647 if (type == Resource::MainResource)
634 return m_documentLoader == frame()->loader().provisionalDocumentLoader() ; 648 return m_documentLoader == frame()->loader().provisionalDocumentLoader() ;
635 return m_documentLoader == frame()->loader().documentLoader(); 649 return m_documentLoader == frame()->loader().documentLoader();
636 } 650 }
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 1558
1545 void ResourceFetcher::trace(Visitor* visitor) 1559 void ResourceFetcher::trace(Visitor* visitor)
1546 { 1560 {
1547 visitor->trace(m_document); 1561 visitor->trace(m_document);
1548 visitor->trace(m_loaders); 1562 visitor->trace(m_loaders);
1549 visitor->trace(m_multipartLoaders); 1563 visitor->trace(m_multipartLoaders);
1550 ResourceLoaderHost::trace(visitor); 1564 ResourceLoaderHost::trace(visitor);
1551 } 1565 }
1552 1566
1553 } 1567 }
OLDNEW
« no previous file with comments | « Source/core/fetch/ResourceFetcher.h ('k') | Source/core/loader/EmptyClients.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698