Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(578)

Side by Side Diff: chrome/browser/worker_host/worker_service.h

Issue 509016: Refactored code to allow associating workers with multiple renderers. (Closed)
Patch Set: Disabled overly-aggressive assertion in ResourceDispatcherHost. Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef CHROME_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ 5 #ifndef CHROME_BROWSER_WORKER_HOST_WORKER_SERVICE_H_
6 #define CHROME_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ 6 #define CHROME_BROWSER_WORKER_HOST_WORKER_SERVICE_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 12 matching lines...) Expand all
23 static WorkerService* GetInstance(); 23 static WorkerService* GetInstance();
24 24
25 // Initialize the WorkerService. OK to be called multiple times. 25 // Initialize the WorkerService. OK to be called multiple times.
26 void Initialize(ResourceDispatcherHost* rdh); 26 void Initialize(ResourceDispatcherHost* rdh);
27 27
28 // Creates a dedicated worker. Returns true on success. 28 // Creates a dedicated worker. Returns true on success.
29 bool CreateWorker(const GURL &url, 29 bool CreateWorker(const GURL &url,
30 bool is_shared, 30 bool is_shared,
31 bool is_off_the_record, 31 bool is_off_the_record,
32 const string16& name, 32 const string16& name,
33 unsigned long long document_id,
33 int renderer_pid, 34 int renderer_pid,
34 int render_view_route_id, 35 int render_view_route_id,
35 IPC::Message::Sender* sender, 36 IPC::Message::Sender* sender,
36 int sender_route_id); 37 int sender_route_id);
37 38
38 // Validates the passed URL and checks for the existence of matching shared 39 // Validates the passed URL and checks for the existence of matching shared
39 // worker. Returns true if the url was found, and sets the url_mismatch out 40 // worker. Returns true if the url was found, and sets the url_mismatch out
40 // param to true/false depending on whether there's a url mismatch with an 41 // param to true/false depending on whether there's a url mismatch with an
41 // existing shared worker with the same name. 42 // existing shared worker with the same name.
42 bool LookupSharedWorker(const GURL &url, 43 bool LookupSharedWorker(const GURL &url,
43 const string16& name, 44 const string16& name,
44 bool off_the_record, 45 bool off_the_record,
45 unsigned long long document_id, 46 unsigned long long document_id,
47 int renderer_pid,
48 int render_view_route_id,
46 IPC::Message::Sender* sender, 49 IPC::Message::Sender* sender,
47 int sender_route_id, 50 int sender_route_id,
48 bool* url_mismatch); 51 bool* url_mismatch);
49 52
50 // Notification from the renderer that a given document has detached, so any 53 // Notification from the renderer that a given document has detached, so any
51 // associated shared workers can be shut down. 54 // associated shared workers can be shut down.
52 void DocumentDetached(IPC::Message::Sender* sender, 55 void DocumentDetached(IPC::Message::Sender* sender,
53 unsigned long long document_id); 56 unsigned long long document_id);
54 57
55 // Cancel creation of a dedicated worker that hasn't started yet. 58 // Cancel creation of a dedicated worker that hasn't started yet.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 97
95 // Returns the WorkerProcessHost from the existing set that has the least 98 // Returns the WorkerProcessHost from the existing set that has the least
96 // number of worker instance running. 99 // number of worker instance running.
97 WorkerProcessHost* GetLeastLoadedWorker(); 100 WorkerProcessHost* GetLeastLoadedWorker();
98 101
99 // Checks if we can create a worker process based on the process limit when 102 // Checks if we can create a worker process based on the process limit when
100 // we're using a strategy of one process per core. 103 // we're using a strategy of one process per core.
101 bool CanCreateWorkerProcess( 104 bool CanCreateWorkerProcess(
102 const WorkerProcessHost::WorkerInstance& instance); 105 const WorkerProcessHost::WorkerInstance& instance);
103 106
107 // Checks if the tab associated with the passed RenderView can create a
108 // worker process based on the process limit when we're using a strategy of
109 // one worker per process.
110 bool TabCanCreateWorkerProcess(
111 int renderer_id, int render_view_route_id, bool* hit_total_worker_limit);
112
104 // NotificationObserver interface. 113 // NotificationObserver interface.
105 void Observe(NotificationType type, 114 void Observe(NotificationType type,
106 const NotificationSource& source, 115 const NotificationSource& source,
107 const NotificationDetails& details); 116 const NotificationDetails& details);
108 117
109 // Notifies us that a process that's talking to a worker has shut down. 118 // Notifies us that a process that's talking to a worker has shut down.
110 void SenderShutdown(IPC::Message::Sender* sender); 119 void SenderShutdown(IPC::Message::Sender* sender);
111 120
112 // Notifies us that a worker process has closed. 121 // Notifies us that a worker process has closed.
113 void WorkerProcessDestroyed(WorkerProcessHost* process); 122 void WorkerProcessDestroyed(WorkerProcessHost* process);
(...skipping 14 matching lines...) Expand all
128 137
129 // These are shared workers that have been looked up, but not created yet. 138 // These are shared workers that have been looked up, but not created yet.
130 // We need to keep a list of these to synchronously detect shared worker 139 // We need to keep a list of these to synchronously detect shared worker
131 // URL mismatches when two pages launch shared workers simultaneously. 140 // URL mismatches when two pages launch shared workers simultaneously.
132 WorkerProcessHost::Instances pending_shared_workers_; 141 WorkerProcessHost::Instances pending_shared_workers_;
133 142
134 DISALLOW_COPY_AND_ASSIGN(WorkerService); 143 DISALLOW_COPY_AND_ASSIGN(WorkerService);
135 }; 144 };
136 145
137 #endif // CHROME_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ 146 #endif // CHROME_BROWSER_WORKER_HOST_WORKER_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/worker_host/worker_process_host.cc ('k') | chrome/browser/worker_host/worker_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698