| 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 "chrome/common/chrome_switches.h" | |
| 14 #include "content/browser/resource_context.h" | 13 #include "content/browser/resource_context.h" |
| 15 #include "content/browser/worker_host/worker_message_filter.h" | 14 #include "content/browser/worker_host/worker_message_filter.h" |
| 16 #include "content/browser/worker_host/worker_process_host.h" | 15 #include "content/browser/worker_host/worker_process_host.h" |
| 16 #include "content/common/content_switches.h" |
| 17 #include "content/common/view_messages.h" | 17 #include "content/common/view_messages.h" |
| 18 #include "content/common/worker_messages.h" | 18 #include "content/common/worker_messages.h" |
| 19 #include "net/base/registry_controlled_domain.h" | 19 #include "net/base/registry_controlled_domain.h" |
| 20 | 20 |
| 21 const int WorkerService::kMaxWorkerProcessesWhenSharing = 10; | 21 const int WorkerService::kMaxWorkerProcessesWhenSharing = 10; |
| 22 const int WorkerService::kMaxWorkersWhenSeparate = 64; | 22 const int WorkerService::kMaxWorkersWhenSeparate = 64; |
| 23 const int WorkerService::kMaxWorkersPerTabWhenSeparate = 16; | 23 const int WorkerService::kMaxWorkersPerTabWhenSeparate = 16; |
| 24 | 24 |
| 25 WorkerService* WorkerService::GetInstance() { | 25 WorkerService* WorkerService::GetInstance() { |
| 26 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 26 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 WorkerProcessHost::WorkerInstance* instance = | 551 WorkerProcessHost::WorkerInstance* instance = |
| 552 FindPendingInstance(url, name, resource_context); | 552 FindPendingInstance(url, name, resource_context); |
| 553 if (instance) | 553 if (instance) |
| 554 return instance; | 554 return instance; |
| 555 | 555 |
| 556 // No existing pending worker - create a new one. | 556 // No existing pending worker - create a new one. |
| 557 WorkerProcessHost::WorkerInstance pending(url, true, name, resource_context); | 557 WorkerProcessHost::WorkerInstance pending(url, true, name, resource_context); |
| 558 pending_shared_workers_.push_back(pending); | 558 pending_shared_workers_.push_back(pending); |
| 559 return &pending_shared_workers_.back(); | 559 return &pending_shared_workers_.back(); |
| 560 } | 560 } |
| OLD | NEW |