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

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

Issue 2787883003: [ServiceWorker] Add EmbeddedWorkerInstanceHost Interface. (Closed)
Patch Set: Created 3 years, 8 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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/strings/string16.h" 17 #include "base/strings/string16.h"
18 #include "content/browser/service_worker/service_worker_lifetime_tracker.h" 18 #include "content/browser/service_worker/service_worker_lifetime_tracker.h"
19 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
20 #include "content/common/service_worker/service_worker_status_code.h" 20 #include "content/common/service_worker/service_worker_status_code.h"
21 21
22 class GURL;
23
24 namespace IPC { 22 namespace IPC {
25 class Message; 23 class Message;
26 } 24 }
27 25
28 namespace content { 26 namespace content {
29 27
30 class EmbeddedWorkerInstance; 28 class EmbeddedWorkerInstance;
31 class ServiceWorkerContextCore; 29 class ServiceWorkerContextCore;
32 30
33 // Acts as a thin stub between MessageFilter and each EmbeddedWorkerInstance, 31 // Acts as a thin stub between MessageFilter and each EmbeddedWorkerInstance,
(...skipping 19 matching lines...) Expand all
53 // This doesn't actually start or stop the worker. 51 // This doesn't actually start or stop the worker.
54 std::unique_ptr<EmbeddedWorkerInstance> CreateWorker(); 52 std::unique_ptr<EmbeddedWorkerInstance> CreateWorker();
55 53
56 // Called from EmbeddedWorkerInstance, relayed to the child process. 54 // Called from EmbeddedWorkerInstance, relayed to the child process.
57 ServiceWorkerStatusCode StopWorker(int process_id, 55 ServiceWorkerStatusCode StopWorker(int process_id,
58 int embedded_worker_id); 56 int embedded_worker_id);
59 57
60 // Stop all active workers, even if they're handling events. 58 // Stop all active workers, even if they're handling events.
61 void Shutdown(); 59 void Shutdown();
62 60
63 // Called back from EmbeddedWorker in the child process, relayed via 61 // Called by EmbeddedWorkerInstance to do some necessary work in the registry.
64 // ServiceWorkerDispatcherHost. 62 bool OnWorkerStarted(int process_id, int embedded_worker_id);
65 void OnWorkerReadyForInspection(int process_id, int embedded_worker_id); 63 void OnWorkerStoppedd(int process_id, int embedded_worker_id);
66 void OnWorkerScriptLoaded(int process_id, int embedded_worker_id); 64
67 void OnWorkerThreadStarted(int process_id,
68 int thread_id,
69 int embedded_worker_id);
70 void OnWorkerScriptLoadFailed(int process_id, int embedded_worker_id);
71 void OnWorkerScriptEvaluated(int process_id,
72 int embedded_worker_id,
73 bool success);
74 void OnWorkerStarted(int process_id, int embedded_worker_id);
75 void OnWorkerStopped(int process_id, int embedded_worker_id);
76 void OnReportException(int embedded_worker_id,
77 const base::string16& error_message,
78 int line_number,
79 int column_number,
80 const GURL& source_url);
81 void OnReportConsoleMessage(int embedded_worker_id,
82 int source_identifier,
83 int message_level,
84 const base::string16& message,
85 int line_number,
86 const GURL& source_url);
87 // Called by EmbeddedWorkerInstance when it learns DevTools has attached to 65 // Called by EmbeddedWorkerInstance when it learns DevTools has attached to
88 // it. 66 // it.
89 void OnDevToolsAttached(int embedded_worker_id); 67 void OnDevToolsAttached(int embedded_worker_id);
90 68
91 // Removes information about the service workers running on the process and 69 // Removes information about the service workers running on the process and
92 // calls ServiceWorkerVersion::OnDetached() on each. Called when the process 70 // calls ServiceWorkerVersion::OnDetached() on each. Called when the process
93 // is terminated. Under normal operation, the workers should already have 71 // is terminated. Under normal operation, the workers should already have
94 // been stopped before the process is terminated, in which case this function 72 // been stopped before the process is terminated, in which case this function
95 // does nothing. But in some cases the process can be terminated unexpectedly 73 // does nothing. But in some cases the process can be terminated unexpectedly
96 // or the workers can fail to stop cleanly. 74 // or the workers can fail to stop cleanly.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 int next_embedded_worker_id_; 125 int next_embedded_worker_id_;
148 const int initial_embedded_worker_id_; 126 const int initial_embedded_worker_id_;
149 ServiceWorkerLifetimeTracker lifetime_tracker_; 127 ServiceWorkerLifetimeTracker lifetime_tracker_;
150 128
151 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerRegistry); 129 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerRegistry);
152 }; 130 };
153 131
154 } // namespace content 132 } // namespace content
155 133
156 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_REGISTRY_H_ 134 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698