OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WORKER_HOST_WORKER_SERVICE_H_ | 5 #ifndef CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ |
6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ | 6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
13 #include "content/browser/worker_host/worker_process_host.h" | 13 #include "content/browser/worker_host/worker_process_host.h" |
14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
16 #include "content/public/browser/worker_service.h" | 16 #include "content/public/browser/worker_service.h" |
17 | 17 |
18 class GURL; | 18 class GURL; |
19 struct ViewHostMsg_CreateWorker_Params; | 19 struct ViewHostMsg_CreateWorker_Params; |
20 | 20 |
| 21 namespace net { |
| 22 class IOBuffer; |
| 23 } |
| 24 |
21 namespace content { | 25 namespace content { |
22 class ResourceContext; | 26 class ResourceContext; |
23 class WorkerServiceObserver; | 27 class WorkerServiceObserver; |
24 class WorkerStoragePartition; | 28 class WorkerStoragePartition; |
25 class WorkerPrioritySetter; | 29 class WorkerPrioritySetter; |
26 | 30 |
27 class CONTENT_EXPORT WorkerServiceImpl | 31 class CONTENT_EXPORT WorkerServiceImpl |
28 : public NON_EXPORTED_BASE(WorkerService) { | 32 : public NON_EXPORTED_BASE(WorkerService) { |
29 public: | 33 public: |
30 // Returns the WorkerServiceImpl singleton. | 34 // Returns the WorkerServiceImpl singleton. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 int* render_view_id) const; | 75 int* render_view_id) const; |
72 const WorkerProcessHost::WorkerInstance* FindWorkerInstance( | 76 const WorkerProcessHost::WorkerInstance* FindWorkerInstance( |
73 int worker_process_id); | 77 int worker_process_id); |
74 | 78 |
75 void NotifyWorkerDestroyed( | 79 void NotifyWorkerDestroyed( |
76 WorkerProcessHost* process, | 80 WorkerProcessHost* process, |
77 int worker_route_id); | 81 int worker_route_id); |
78 | 82 |
79 void NotifyWorkerProcessCreated(); | 83 void NotifyWorkerProcessCreated(); |
80 | 84 |
| 85 // Support for worker-like contexts that are not actually WebSharedWorkers |
| 86 // and don't have associated sets of documents. Outside parties do not |
| 87 // open message ports to these contexts, and connected documents |
| 88 // do not determine their lifetimes. |
| 89 int CreateAndStartEmbeddedWorker( |
| 90 ResourceContext* resource_context, |
| 91 const WorkerStoragePartition& worker_partition, |
| 92 const GURL& url, |
| 93 const std::string& raw_handler_source, |
| 94 int64 associated_appcache_id); |
| 95 bool SendToEmbeddedWorker(int worker_route_id, IPC::Message* message); |
| 96 void TerminateEmbeddedWorker(int worker_route_id); |
| 97 |
81 // Used when we run each worker in a separate process. | 98 // Used when we run each worker in a separate process. |
82 static const int kMaxWorkersWhenSeparate; | 99 static const int kMaxWorkersWhenSeparate; |
83 static const int kMaxWorkersPerTabWhenSeparate; | 100 static const int kMaxWorkersPerTabWhenSeparate; |
84 | 101 |
85 private: | 102 private: |
86 friend struct DefaultSingletonTraits<WorkerServiceImpl>; | 103 friend struct DefaultSingletonTraits<WorkerServiceImpl>; |
87 | 104 |
88 WorkerServiceImpl(); | 105 WorkerServiceImpl(); |
89 virtual ~WorkerServiceImpl(); | 106 virtual ~WorkerServiceImpl(); |
90 | 107 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 WorkerProcessHost::Instances pending_shared_workers_; | 157 WorkerProcessHost::Instances pending_shared_workers_; |
141 | 158 |
142 ObserverList<WorkerServiceObserver> observers_; | 159 ObserverList<WorkerServiceObserver> observers_; |
143 | 160 |
144 DISALLOW_COPY_AND_ASSIGN(WorkerServiceImpl); | 161 DISALLOW_COPY_AND_ASSIGN(WorkerServiceImpl); |
145 }; | 162 }; |
146 | 163 |
147 } // namespace content | 164 } // namespace content |
148 | 165 |
149 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ | 166 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ |
OLD | NEW |