Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_dom_workers_ServiceWorkerScriptCache_h
8 : #define mozilla_dom_workers_ServiceWorkerScriptCache_h
9 :
10 : #include "nsString.h"
11 :
12 : class nsILoadGroup;
13 : class nsIPrincipal;
14 :
15 : namespace mozilla {
16 : namespace dom {
17 : namespace workers {
18 :
19 : class ServiceWorkerRegistrationInfo;
20 :
21 : namespace serviceWorkerScriptCache {
22 :
23 : nsresult
24 : PurgeCache(nsIPrincipal* aPrincipal, const nsAString& aCacheName);
25 :
26 : nsresult
27 : GenerateCacheName(nsAString& aName);
28 :
29 0 : class CompareCallback
30 : {
31 : public:
32 : /*
33 : * If there is an error, ignore aInCacheAndEqual and aNewCacheName.
34 : * On success, if the cached result and network result matched,
35 : * aInCacheAndEqual will be true and no new cache name is passed, otherwise
36 : * use the new cache name to load the ServiceWorker.
37 : */
38 : virtual void
39 : ComparisonResult(nsresult aStatus,
40 : bool aInCacheAndEqual,
41 : const nsAString& aNewCacheName,
42 : const nsACString& aMaxScope,
43 : nsLoadFlags aLoadFlags) = 0;
44 :
45 : NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
46 : };
47 :
48 : nsresult
49 : Compare(ServiceWorkerRegistrationInfo* aRegistration,
50 : nsIPrincipal* aPrincipal, const nsAString& aCacheName,
51 : const nsAString& aURL, CompareCallback* aCallback, nsILoadGroup* aLoadGroup);
52 :
53 : } // namespace serviceWorkerScriptCache
54 :
55 : } // namespace workers
56 : } // namespace dom
57 : } // namespace mozilla
58 :
59 : #endif // mozilla_dom_workers_ServiceWorkerScriptCache_h
|