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 #include "content/browser/worker_host/worker_service.h" | 5 #include "content/browser/worker_host/worker_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/sys_info.h" | 11 #include "base/sys_info.h" |
12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
13 #include "content/browser/resource_context.h" | 13 #include "content/browser/resource_context.h" |
14 #include "content/browser/worker_host/worker_message_filter.h" | 14 #include "content/browser/worker_host/worker_message_filter.h" |
15 #include "content/browser/worker_host/worker_process_host.h" | 15 #include "content/browser/worker_host/worker_process_host.h" |
16 #include "content/browser/worker_host/worker_service_observer.h" | 16 #include "content/browser/worker_host/worker_service_observer.h" |
17 #include "content/common/content_switches.h" | |
18 #include "content/common/view_messages.h" | 17 #include "content/common/view_messages.h" |
19 #include "content/common/worker_messages.h" | 18 #include "content/common/worker_messages.h" |
| 19 #include "content/public/common/content_switches.h" |
20 #include "net/base/registry_controlled_domain.h" | 20 #include "net/base/registry_controlled_domain.h" |
21 | 21 |
22 const int WorkerService::kMaxWorkerProcessesWhenSharing = 10; | 22 const int WorkerService::kMaxWorkerProcessesWhenSharing = 10; |
23 const int WorkerService::kMaxWorkersWhenSeparate = 64; | 23 const int WorkerService::kMaxWorkersWhenSeparate = 64; |
24 const int WorkerService::kMaxWorkersPerTabWhenSeparate = 16; | 24 const int WorkerService::kMaxWorkersPerTabWhenSeparate = 16; |
25 | 25 |
26 WorkerService* WorkerService::GetInstance() { | 26 WorkerService* WorkerService::GetInstance() { |
27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
28 return Singleton<WorkerService>::get(); | 28 return Singleton<WorkerService>::get(); |
29 } | 29 } |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 WorkerProcessHost::WorkerInstance* instance = | 579 WorkerProcessHost::WorkerInstance* instance = |
580 FindPendingInstance(url, name, resource_context); | 580 FindPendingInstance(url, name, resource_context); |
581 if (instance) | 581 if (instance) |
582 return instance; | 582 return instance; |
583 | 583 |
584 // No existing pending worker - create a new one. | 584 // No existing pending worker - create a new one. |
585 WorkerProcessHost::WorkerInstance pending(url, true, name, resource_context); | 585 WorkerProcessHost::WorkerInstance pending(url, true, name, resource_context); |
586 pending_shared_workers_.push_back(pending); | 586 pending_shared_workers_.push_back(pending); |
587 return &pending_shared_workers_.back(); | 587 return &pending_shared_workers_.back(); |
588 } | 588 } |
OLD | NEW |