OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/worker_host/worker_service.h" | 5 #include "chrome/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/singleton.h" | 10 #include "base/singleton.h" |
11 #include "base/sys_info.h" | 11 #include "base/sys_info.h" |
12 #include "base/thread.h" | 12 #include "base/thread.h" |
13 #include "chrome/browser/content_settings/host_content_settings_map.h" | 13 #include "chrome/browser/content_settings/host_content_settings_map.h" |
14 #include "chrome/browser/plugin_service.h" | 14 #include "chrome/browser/plugin_service.h" |
| 15 #include "chrome/browser/renderer_host/render_message_filter.h" |
15 #include "chrome/browser/renderer_host/render_process_host.h" | 16 #include "chrome/browser/renderer_host/render_process_host.h" |
16 #include "chrome/browser/renderer_host/resource_message_filter.h" | |
17 #include "chrome/browser/worker_host/worker_process_host.h" | 17 #include "chrome/browser/worker_host/worker_process_host.h" |
18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/notification_service.h" | 19 #include "chrome/common/notification_service.h" |
20 #include "chrome/common/render_messages.h" | 20 #include "chrome/common/render_messages.h" |
21 #include "chrome/common/worker_messages.h" | 21 #include "chrome/common/worker_messages.h" |
22 #include "net/base/registry_controlled_domain.h" | 22 #include "net/base/registry_controlled_domain.h" |
23 | 23 |
24 const int WorkerService::kMaxWorkerProcessesWhenSharing = 10; | 24 const int WorkerService::kMaxWorkerProcessesWhenSharing = 10; |
25 const int WorkerService::kMaxWorkersWhenSeparate = 64; | 25 const int WorkerService::kMaxWorkersWhenSeparate = 64; |
26 const int WorkerService::kMaxWorkersPerTabWhenSeparate = 16; | 26 const int WorkerService::kMaxWorkersPerTabWhenSeparate = 16; |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 } | 438 } |
439 } | 439 } |
440 | 440 |
441 return true; | 441 return true; |
442 } | 442 } |
443 | 443 |
444 void WorkerService::Observe(NotificationType type, | 444 void WorkerService::Observe(NotificationType type, |
445 const NotificationSource& source, | 445 const NotificationSource& source, |
446 const NotificationDetails& details) { | 446 const NotificationDetails& details) { |
447 if (type.value == NotificationType::RESOURCE_MESSAGE_FILTER_SHUTDOWN) { | 447 if (type.value == NotificationType::RESOURCE_MESSAGE_FILTER_SHUTDOWN) { |
448 ResourceMessageFilter* sender = Source<ResourceMessageFilter>(source).ptr(); | 448 RenderMessageFilter* sender = Source<RenderMessageFilter>(source).ptr(); |
449 SenderShutdown(sender); | 449 SenderShutdown(sender); |
450 } else if (type.value == NotificationType::WORKER_PROCESS_HOST_SHUTDOWN) { | 450 } else if (type.value == NotificationType::WORKER_PROCESS_HOST_SHUTDOWN) { |
451 WorkerProcessHost* sender = Source<WorkerProcessHost>(source).ptr(); | 451 WorkerProcessHost* sender = Source<WorkerProcessHost>(source).ptr(); |
452 SenderShutdown(sender); | 452 SenderShutdown(sender); |
453 WorkerProcessDestroyed(sender); | 453 WorkerProcessDestroyed(sender); |
454 } else { | 454 } else { |
455 NOTREACHED(); | 455 NOTREACHED(); |
456 } | 456 } |
457 } | 457 } |
458 | 458 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 FindPendingInstance(url, name, off_the_record); | 582 FindPendingInstance(url, name, off_the_record); |
583 if (instance) | 583 if (instance) |
584 return instance; | 584 return instance; |
585 | 585 |
586 // No existing pending worker - create a new one. | 586 // No existing pending worker - create a new one. |
587 WorkerProcessHost::WorkerInstance pending( | 587 WorkerProcessHost::WorkerInstance pending( |
588 url, true, off_the_record, name, MSG_ROUTING_NONE, 0, 0, 0, NULL); | 588 url, true, off_the_record, name, MSG_ROUTING_NONE, 0, 0, 0, NULL); |
589 pending_shared_workers_.push_back(pending); | 589 pending_shared_workers_.push_back(pending); |
590 return &pending_shared_workers_.back(); | 590 return &pending_shared_workers_.back(); |
591 } | 591 } |
OLD | NEW |