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

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

Issue 317953004: Set the "waiting" Service Worker of Service Worker providers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bring patch to head. Created 6 years, 6 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 22 matching lines...) Expand all
33 // this needs to be RefCountedThreadSafe and .current info needs to be 33 // this needs to be RefCountedThreadSafe and .current info needs to be
34 // handled in a thread-safe manner (e.g. by a lock etc). 34 // handled in a thread-safe manner (e.g. by a lock etc).
35 class ServiceWorkerProviderContext 35 class ServiceWorkerProviderContext
36 : public base::RefCounted<ServiceWorkerProviderContext> { 36 : public base::RefCounted<ServiceWorkerProviderContext> {
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 OnSetWaitingServiceWorker(int provider_id,
44 const ServiceWorkerObjectInfo& info);
43 void OnSetCurrentServiceWorker(int provider_id, 45 void OnSetCurrentServiceWorker(int provider_id,
44 const ServiceWorkerObjectInfo& info); 46 const ServiceWorkerObjectInfo& info);
45 47
46 int provider_id() const { return provider_id_; } 48 int provider_id() const { return provider_id_; }
47 49
50 ServiceWorkerHandleReference* waiting();
48 // Gets the context's handle reference for .controller. 51 // Gets the context's handle reference for .controller.
49 // TODO(dominicc): Rename this to "controller". 52 // TODO(dominicc): Rename this to "controller".
50 ServiceWorkerHandleReference* current(); 53 ServiceWorkerHandleReference* current();
51 54
52 // Gets the handle ID of the controller, or 55 // Gets the handle ID of the controller, or
53 // kInvalidServiceWorkerHandleId if the provider is not controlled 56 // kInvalidServiceWorkerHandleId if the provider is not controlled
54 // by a Service Worker. 57 // by a Service Worker.
55 int current_handle_id() const; 58 int current_handle_id() const;
56 59
60 // Gets the handle ID of the waiting Service Worker, or
61 // kInvalidServiceWorkerHandleId if the provider does not have a
62 // waiting Service Worker.
63 int waiting_handle_id() const;
64
57 private: 65 private:
58 friend class base::RefCounted<ServiceWorkerProviderContext>; 66 friend class base::RefCounted<ServiceWorkerProviderContext>;
59 ~ServiceWorkerProviderContext(); 67 ~ServiceWorkerProviderContext();
60 68
61 const int provider_id_; 69 const int provider_id_;
62 scoped_refptr<base::MessageLoopProxy> main_thread_loop_proxy_; 70 scoped_refptr<base::MessageLoopProxy> main_thread_loop_proxy_;
63 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 71 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
72 scoped_ptr<ServiceWorkerHandleReference> waiting_;
64 scoped_ptr<ServiceWorkerHandleReference> current_; 73 scoped_ptr<ServiceWorkerHandleReference> current_;
65 74
66 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderContext); 75 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderContext);
67 }; 76 };
68 77
69 } // namespace content 78 } // namespace content
70 79
71 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_ 80 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698