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

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

Issue 309503014: Make ServiceWorkerDispatcher reuse existing WebServiceWorkerImpls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Correct comment. 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
« no previous file with comments | « no previous file | content/child/service_worker/service_worker_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_DISPATCHER_H_ 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_
6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ 6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // (This is attached only to the document thread's ServiceWorkerDispatcher) 63 // (This is attached only to the document thread's ServiceWorkerDispatcher)
64 void AddProviderContext(ServiceWorkerProviderContext* provider_context); 64 void AddProviderContext(ServiceWorkerProviderContext* provider_context);
65 void RemoveProviderContext(ServiceWorkerProviderContext* provider_context); 65 void RemoveProviderContext(ServiceWorkerProviderContext* provider_context);
66 66
67 // Called when navigator.serviceWorker is instantiated or detached 67 // Called when navigator.serviceWorker is instantiated or detached
68 // for a document whose provider can be identified by |provider_id|. 68 // for a document whose provider can be identified by |provider_id|.
69 void AddScriptClient(int provider_id, 69 void AddScriptClient(int provider_id,
70 blink::WebServiceWorkerProviderClient* client); 70 blink::WebServiceWorkerProviderClient* client);
71 void RemoveScriptClient(int provider_id); 71 void RemoveScriptClient(int provider_id);
72 72
73 // If an existing WebServiceWorkerImpl exists for the Service
74 // Worker, it is returned; otherwise a WebServiceWorkerImpl is
75 // created and its ownership is transferred to the caller. If
76 // |adopt_handle| is true, a ServiceWorkerHandleReference will be
77 // adopted for the specified Service Worker.
78 //
79 // TODO(dominicc): The lifetime of WebServiceWorkerImpl is too tricky; this
80 // method can return an existing WebServiceWorkerImpl, in which case
81 // it is owned by a WebCore::ServiceWorker and the lifetime is not
82 // being transferred to the owner; or it can create a
83 // WebServiceWorkerImpl, in which case ownership is transferred to
84 // the caller who must bounce it to a method that will associate it
85 // with a WebCore::ServiceWorker.
86 WebServiceWorkerImpl* GetServiceWorker(const ServiceWorkerObjectInfo&,
87 bool adopt_handle);
88
73 // |thread_safe_sender| needs to be passed in because if the call leads to 89 // |thread_safe_sender| needs to be passed in because if the call leads to
74 // construction it will be needed. 90 // construction it will be needed.
75 static ServiceWorkerDispatcher* GetOrCreateThreadSpecificInstance( 91 static ServiceWorkerDispatcher* GetOrCreateThreadSpecificInstance(
76 ThreadSafeSender* thread_safe_sender); 92 ThreadSafeSender* thread_safe_sender);
77 93
78 // Unlike GetOrCreateThreadSpecificInstance() this doesn't create a new 94 // Unlike GetOrCreateThreadSpecificInstance() this doesn't create a new
79 // instance if thread-local instance doesn't exist. 95 // instance if thread-local instance doesn't exist.
80 static ServiceWorkerDispatcher* GetThreadSpecificInstance(); 96 static ServiceWorkerDispatcher* GetThreadSpecificInstance();
81 97
82 private: 98 private:
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 WorkerToProviderMap worker_to_provider_; 143 WorkerToProviderMap worker_to_provider_;
128 144
129 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 145 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
130 146
131 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); 147 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher);
132 }; 148 };
133 149
134 } // namespace content 150 } // namespace content
135 151
136 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ 152 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_
OLDNEW
« no previous file with comments | « no previous file | content/child/service_worker/service_worker_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698