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

Side by Side Diff: content/child/service_worker/service_worker_provider_context.h

Issue 354643003: ServiceWorker: Support navigator.serviceWorker.active (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_ 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_
6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_ 6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 26 matching lines...) Expand all
37 public: 37 public:
38 explicit ServiceWorkerProviderContext(int provider_id); 38 explicit ServiceWorkerProviderContext(int provider_id);
39 39
40 // Called from ServiceWorkerDispatcher. 40 // Called from ServiceWorkerDispatcher.
41 void OnServiceWorkerStateChanged(int handle_id, 41 void OnServiceWorkerStateChanged(int handle_id,
42 blink::WebServiceWorkerState state); 42 blink::WebServiceWorkerState state);
43 void OnSetInstallingServiceWorker(int provider_id, 43 void OnSetInstallingServiceWorker(int provider_id,
44 const ServiceWorkerObjectInfo& info); 44 const ServiceWorkerObjectInfo& info);
45 void OnSetWaitingServiceWorker(int provider_id, 45 void OnSetWaitingServiceWorker(int provider_id,
46 const ServiceWorkerObjectInfo& info); 46 const ServiceWorkerObjectInfo& info);
47 void OnSetActiveServiceWorker(int provider_id,
48 const ServiceWorkerObjectInfo& info);
47 void OnSetControllerServiceWorker(int provider_id, 49 void OnSetControllerServiceWorker(int provider_id,
48 const ServiceWorkerObjectInfo& info); 50 const ServiceWorkerObjectInfo& info);
49 51
50 int provider_id() const { return provider_id_; } 52 int provider_id() const { return provider_id_; }
51 53
52 ServiceWorkerHandleReference* installing(); 54 ServiceWorkerHandleReference* installing();
53 ServiceWorkerHandleReference* waiting(); 55 ServiceWorkerHandleReference* waiting();
56 ServiceWorkerHandleReference* active();
54 ServiceWorkerHandleReference* controller(); 57 ServiceWorkerHandleReference* controller();
55 58
56 // Gets the handle ID of the installing Service Worker, or 59 // Gets the handle ID of the installing Service Worker, or
57 // kInvalidServiceWorkerHandleId if the provider does not have a 60 // kInvalidServiceWorkerHandleId if the provider does not have a
58 // installing Service Worker. 61 // installing Service Worker.
59 int installing_handle_id() const; 62 int installing_handle_id() const;
60 63
61 // Gets the handle ID of the waiting Service Worker, or 64 // Gets the handle ID of the waiting Service Worker, or
62 // kInvalidServiceWorkerHandleId if the provider does not have a 65 // kInvalidServiceWorkerHandleId if the provider does not have a
63 // waiting Service Worker. 66 // waiting Service Worker.
64 int waiting_handle_id() const; 67 int waiting_handle_id() const;
65 68
66 // Gets the handle ID of the controller, or 69 // Gets the handle ID of the active Service Worker, or
70 // kInvalidServiceWorkerHandleId if the provider does not have an active
71 // Service Worker.
72 int active_handle_id() const;
73
74 // Gets the handle ID of the controller Service Worker, or
67 // kInvalidServiceWorkerHandleId if the provider is not controlled 75 // kInvalidServiceWorkerHandleId if the provider is not controlled
68 // by a Service Worker. 76 // by a Service Worker.
69 int controller_handle_id() const; 77 int controller_handle_id() const;
70 78
71 private: 79 private:
72 friend class base::RefCounted<ServiceWorkerProviderContext>; 80 friend class base::RefCounted<ServiceWorkerProviderContext>;
73 ~ServiceWorkerProviderContext(); 81 ~ServiceWorkerProviderContext();
74 82
75 const int provider_id_; 83 const int provider_id_;
76 scoped_refptr<base::MessageLoopProxy> main_thread_loop_proxy_; 84 scoped_refptr<base::MessageLoopProxy> main_thread_loop_proxy_;
77 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 85 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
78 scoped_ptr<ServiceWorkerHandleReference> installing_; 86 scoped_ptr<ServiceWorkerHandleReference> installing_;
79 scoped_ptr<ServiceWorkerHandleReference> waiting_; 87 scoped_ptr<ServiceWorkerHandleReference> waiting_;
88 scoped_ptr<ServiceWorkerHandleReference> active_;
80 scoped_ptr<ServiceWorkerHandleReference> controller_; 89 scoped_ptr<ServiceWorkerHandleReference> controller_;
81 90
82 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderContext); 91 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderContext);
83 }; 92 };
84 93
85 } // namespace content 94 } // namespace content
86 95
87 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_ 96 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698