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

Side by Side Diff: Source/modules/serviceworkers/ServiceWorkerContainer.h

Issue 476043002: ServiceWorker: Make '.ready' return a promise to be resolved with ServiceWorkerRegistration (1/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase on 478693005 (Ship Oilpan for serviceworkers/) Created 6 years, 3 months 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 | « no previous file | Source/modules/serviceworkers/ServiceWorkerContainer.cpp » ('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) 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 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #ifndef ServiceWorkerContainer_h 31 #ifndef ServiceWorkerContainer_h
32 #define ServiceWorkerContainer_h 32 #define ServiceWorkerContainer_h
33 33
34 #include "bindings/core/v8/ScriptPromise.h" 34 #include "bindings/core/v8/ScriptPromise.h"
35 #include "bindings/core/v8/ScriptPromiseProperty.h" 35 #include "bindings/core/v8/ScriptPromiseProperty.h"
36 #include "bindings/core/v8/ScriptWrappable.h" 36 #include "bindings/core/v8/ScriptWrappable.h"
37 #include "core/dom/ContextLifecycleObserver.h" 37 #include "core/dom/ContextLifecycleObserver.h"
38 #include "modules/serviceworkers/ServiceWorker.h" 38 #include "modules/serviceworkers/ServiceWorker.h"
39 #include "modules/serviceworkers/ServiceWorkerRegistration.h"
39 #include "platform/heap/Handle.h" 40 #include "platform/heap/Handle.h"
40 #include "public/platform/WebServiceWorkerProviderClient.h" 41 #include "public/platform/WebServiceWorkerProviderClient.h"
41 #include "wtf/Forward.h" 42 #include "wtf/Forward.h"
42 #include "wtf/PassRefPtr.h" 43 #include "wtf/PassRefPtr.h"
43 #include "wtf/RefPtr.h" 44 #include "wtf/RefPtr.h"
44 45
45 namespace blink { 46 namespace blink {
46 47
47 class Dictionary; 48 class Dictionary;
48 class ExecutionContext; 49 class ExecutionContext;
49 class ServiceWorker;
50 class WebServiceWorker; 50 class WebServiceWorker;
51 class WebServiceWorkerProvider; 51 class WebServiceWorkerProvider;
52 class WebServiceWorkerRegistration;
52 53
53 class ServiceWorkerContainer FINAL 54 class ServiceWorkerContainer FINAL
54 : public GarbageCollectedFinalized<ServiceWorkerContainer> 55 : public GarbageCollectedFinalized<ServiceWorkerContainer>
55 , public ScriptWrappable 56 , public ScriptWrappable
56 , public ContextLifecycleObserver 57 , public ContextLifecycleObserver
57 , public WebServiceWorkerProviderClient { 58 , public WebServiceWorkerProviderClient {
58 DEFINE_WRAPPERTYPEINFO(); 59 DEFINE_WRAPPERTYPEINFO();
59 public: 60 public:
60 static ServiceWorkerContainer* create(ExecutionContext*); 61 static ServiceWorkerContainer* create(ExecutionContext*);
61 ~ServiceWorkerContainer(); 62 ~ServiceWorkerContainer();
(...skipping 10 matching lines...) Expand all
72 WebServiceWorkerProvider* provider() { return m_provider; } 73 WebServiceWorkerProvider* provider() { return m_provider; }
73 74
74 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con st Dictionary&); 75 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con st Dictionary&);
75 ScriptPromise unregisterServiceWorker(ScriptState*, const String& scope); 76 ScriptPromise unregisterServiceWorker(ScriptState*, const String& scope);
76 77
77 // WebServiceWorkerProviderClient overrides. 78 // WebServiceWorkerProviderClient overrides.
78 virtual void setActive(WebServiceWorker*) OVERRIDE; 79 virtual void setActive(WebServiceWorker*) OVERRIDE;
79 virtual void setController(WebServiceWorker*) OVERRIDE; 80 virtual void setController(WebServiceWorker*) OVERRIDE;
80 virtual void setInstalling(WebServiceWorker*) OVERRIDE; 81 virtual void setInstalling(WebServiceWorker*) OVERRIDE;
81 virtual void setWaiting(WebServiceWorker*) OVERRIDE; 82 virtual void setWaiting(WebServiceWorker*) OVERRIDE;
83 virtual void setReadyRegistration(WebServiceWorkerRegistration*) OVERRIDE;
82 virtual void dispatchMessageEvent(const WebString& message, const WebMessage PortChannelArray&) OVERRIDE; 84 virtual void dispatchMessageEvent(const WebString& message, const WebMessage PortChannelArray&) OVERRIDE;
83 85
84 private: 86 private:
85 explicit ServiceWorkerContainer(ExecutionContext*); 87 explicit ServiceWorkerContainer(ExecutionContext*);
86 88
87 typedef ScriptPromiseProperty<Member<ServiceWorkerContainer>, RefPtrWillBeMe mber<ServiceWorker>, RefPtrWillBeMember<ServiceWorker> > ReadyProperty; 89 typedef ScriptPromiseProperty<Member<ServiceWorkerContainer>, Member<Service WorkerRegistration>, Member<ServiceWorkerRegistration> > ReadyProperty;
88 ReadyProperty* createReadyProperty(); 90 ReadyProperty* createReadyProperty();
89 void checkReadyChanged(PassRefPtrWillBeRawPtr<ServiceWorker> previousReadyWo rker);
90 91
91 WebServiceWorkerProvider* m_provider; 92 WebServiceWorkerProvider* m_provider;
92 RefPtrWillBeMember<ServiceWorker> m_active; 93 RefPtrWillBeMember<ServiceWorker> m_active;
93 RefPtrWillBeMember<ServiceWorker> m_controller; 94 RefPtrWillBeMember<ServiceWorker> m_controller;
94 RefPtrWillBeMember<ServiceWorker> m_installing; 95 RefPtrWillBeMember<ServiceWorker> m_installing;
95 RefPtrWillBeMember<ServiceWorker> m_waiting; 96 RefPtrWillBeMember<ServiceWorker> m_waiting;
97 Member<ServiceWorkerRegistration> m_readyRegistration;
96 Member<ReadyProperty> m_ready; 98 Member<ReadyProperty> m_ready;
97 }; 99 };
98 100
99 } // namespace blink 101 } // namespace blink
100 102
101 #endif // ServiceWorkerContainer_h 103 #endif // ServiceWorkerContainer_h
OLDNEW
« no previous file with comments | « no previous file | Source/modules/serviceworkers/ServiceWorkerContainer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698