| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| 11 #include "base/threading/non_thread_safe.h" |
| 11 #include "content/browser/worker_host/worker_process_host.h" | 12 #include "content/browser/worker_host/worker_process_host.h" |
| 12 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 13 | 14 |
| 15 namespace content { |
| 16 class ResourceContext; |
| 17 } // namespace content |
| 14 namespace net { | 18 namespace net { |
| 15 class URLRequestContextGetter; | 19 class URLRequestContextGetter; |
| 16 } | 20 } // namespace net |
| 17 | |
| 18 struct ViewHostMsg_CreateWorker_Params; | 21 struct ViewHostMsg_CreateWorker_Params; |
| 19 | 22 |
| 20 // A singelton for managing HTML5 web workers. | 23 // A singleton for managing HTML5 web workers. |
| 21 class WorkerService { | 24 class WorkerService { |
| 22 public: | 25 public: |
| 23 // Returns the WorkerService singleton. | 26 // Returns the WorkerService singleton. |
| 24 static WorkerService* GetInstance(); | 27 static WorkerService* GetInstance(); |
| 25 | 28 |
| 26 // These methods correspond to worker related IPCs. | 29 // These methods correspond to worker related IPCs. |
| 27 void CreateWorker(const ViewHostMsg_CreateWorker_Params& params, | 30 void CreateWorker(const ViewHostMsg_CreateWorker_Params& params, |
| 28 int route_id, | 31 int route_id, |
| 29 WorkerMessageFilter* filter, | 32 WorkerMessageFilter* filter, |
| 30 net::URLRequestContextGetter* request_context); | 33 net::URLRequestContextGetter* request_context_getter, |
| 34 const content::ResourceContext& resource_context); |
| 31 void LookupSharedWorker(const ViewHostMsg_CreateWorker_Params& params, | 35 void LookupSharedWorker(const ViewHostMsg_CreateWorker_Params& params, |
| 32 int route_id, | 36 int route_id, |
| 33 WorkerMessageFilter* filter, | 37 WorkerMessageFilter* filter, |
| 34 bool incognito, | 38 bool incognito, |
| 35 bool* exists, | 39 bool* exists, |
| 36 bool* url_error); | 40 bool* url_error); |
| 37 void CancelCreateDedicatedWorker(int route_id, WorkerMessageFilter* filter); | 41 void CancelCreateDedicatedWorker(int route_id, WorkerMessageFilter* filter); |
| 38 void ForwardToWorker(const IPC::Message& message, | 42 void ForwardToWorker(const IPC::Message& message, |
| 39 WorkerMessageFilter* filter); | 43 WorkerMessageFilter* filter); |
| 40 void DocumentDetached(unsigned long long document_id, | 44 void DocumentDetached(unsigned long long document_id, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 119 |
| 116 // These are shared workers that have been looked up, but not created yet. | 120 // These are shared workers that have been looked up, but not created yet. |
| 117 // We need to keep a list of these to synchronously detect shared worker | 121 // We need to keep a list of these to synchronously detect shared worker |
| 118 // URL mismatches when two pages launch shared workers simultaneously. | 122 // URL mismatches when two pages launch shared workers simultaneously. |
| 119 WorkerProcessHost::Instances pending_shared_workers_; | 123 WorkerProcessHost::Instances pending_shared_workers_; |
| 120 | 124 |
| 121 DISALLOW_COPY_AND_ASSIGN(WorkerService); | 125 DISALLOW_COPY_AND_ASSIGN(WorkerService); |
| 122 }; | 126 }; |
| 123 | 127 |
| 124 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ | 128 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ |
| OLD | NEW |