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

Side by Side Diff: content/browser/service_worker/embedded_worker_registry.h

Issue 2637743002: ServiceWorker: remove EmbeddedWorkerMsg_StartWorker (Closed)
Patch Set: Removed unnecessary includes and codes Created 3 years, 11 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
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_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_REGISTRY_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_REGISTRY_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_REGISTRY_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_REGISTRY_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 10 matching lines...) Expand all
21 class GURL; 21 class GURL;
22 22
23 namespace IPC { 23 namespace IPC {
24 class Message; 24 class Message;
25 class Sender; 25 class Sender;
26 } 26 }
27 27
28 namespace content { 28 namespace content {
29 29
30 class EmbeddedWorkerInstance; 30 class EmbeddedWorkerInstance;
31 struct EmbeddedWorkerStartParams;
32 class MessagePortMessageFilter; 31 class MessagePortMessageFilter;
33 class ServiceWorkerContextCore; 32 class ServiceWorkerContextCore;
34 33
35 // Acts as a thin stub between MessageFilter and each EmbeddedWorkerInstance, 34 // Acts as a thin stub between MessageFilter and each EmbeddedWorkerInstance,
36 // which sends/receives messages to/from each EmbeddedWorker in child process. 35 // which sends/receives messages to/from each EmbeddedWorker in child process.
37 // 36 //
38 // Hangs off ServiceWorkerContextCore (its reference is also held by each 37 // Hangs off ServiceWorkerContextCore (its reference is also held by each
39 // EmbeddedWorkerInstance). Operated only on IO thread. 38 // EmbeddedWorkerInstance). Operated only on IO thread.
40 class CONTENT_EXPORT EmbeddedWorkerRegistry 39 class CONTENT_EXPORT EmbeddedWorkerRegistry
41 : public NON_EXPORTED_BASE(base::RefCounted<EmbeddedWorkerRegistry>) { 40 : public NON_EXPORTED_BASE(base::RefCounted<EmbeddedWorkerRegistry>) {
42 public: 41 public:
43 typedef base::Callback<void(ServiceWorkerStatusCode)> StatusCallback; 42 typedef base::Callback<void(ServiceWorkerStatusCode)> StatusCallback;
44 43
45 static scoped_refptr<EmbeddedWorkerRegistry> Create( 44 static scoped_refptr<EmbeddedWorkerRegistry> Create(
46 const base::WeakPtr<ServiceWorkerContextCore>& contxet); 45 const base::WeakPtr<ServiceWorkerContextCore>& contxet);
47 46
48 // Used for DeleteAndStartOver. Creates a new registry which takes over 47 // Used for DeleteAndStartOver. Creates a new registry which takes over
49 // |next_embedded_worker_id_| and |process_sender_map_| from |old_registry|. 48 // |next_embedded_worker_id_| and |process_sender_map_| from |old_registry|.
50 static scoped_refptr<EmbeddedWorkerRegistry> Create( 49 static scoped_refptr<EmbeddedWorkerRegistry> Create(
51 const base::WeakPtr<ServiceWorkerContextCore>& context, 50 const base::WeakPtr<ServiceWorkerContextCore>& context,
52 EmbeddedWorkerRegistry* old_registry); 51 EmbeddedWorkerRegistry* old_registry);
53 52
54 bool OnMessageReceived(const IPC::Message& message, int process_id); 53 bool OnMessageReceived(const IPC::Message& message, int process_id);
55 54
56 // Creates and removes a new worker instance entry for bookkeeping. 55 // Creates and removes a new worker instance entry for bookkeeping.
57 // This doesn't actually start or stop the worker. 56 // This doesn't actually start or stop the worker.
58 std::unique_ptr<EmbeddedWorkerInstance> CreateWorker(); 57 std::unique_ptr<EmbeddedWorkerInstance> CreateWorker();
59 58
60 // Called from EmbeddedWorkerInstance, relayed to the child process. 59 // Called from EmbeddedWorkerInstance, relayed to the child process.
61 ServiceWorkerStatusCode SendStartWorker(
62 std::unique_ptr<EmbeddedWorkerStartParams> params,
63 int process_id);
64 ServiceWorkerStatusCode StopWorker(int process_id, 60 ServiceWorkerStatusCode StopWorker(int process_id,
65 int embedded_worker_id); 61 int embedded_worker_id);
66 62
67 // Stop all active workers, even if they're handling events. 63 // Stop all active workers, even if they're handling events.
68 void Shutdown(); 64 void Shutdown();
69 65
70 // Called back from EmbeddedWorker in the child process, relayed via 66 // Called back from EmbeddedWorker in the child process, relayed via
71 // ServiceWorkerDispatcherHost. 67 // ServiceWorkerDispatcherHost.
72 void OnWorkerReadyForInspection(int process_id, int embedded_worker_id); 68 void OnWorkerReadyForInspection(int process_id, int embedded_worker_id);
73 void OnWorkerScriptLoaded(int process_id, int embedded_worker_id); 69 void OnWorkerScriptLoaded(int process_id, int embedded_worker_id);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 152
157 int next_embedded_worker_id_; 153 int next_embedded_worker_id_;
158 const int initial_embedded_worker_id_; 154 const int initial_embedded_worker_id_;
159 155
160 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerRegistry); 156 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerRegistry);
161 }; 157 };
162 158
163 } // namespace content 159 } // namespace content
164 160
165 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_REGISTRY_H_ 161 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698