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

Side by Side Diff: content/browser/worker_host/worker_process_host.cc

Issue 8514004: Remove includes of worker_messages.h from chrome code, since that's an internal detail of content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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_process_host.h" 5 #include "content/browser/worker_host/worker_process_host.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base_switches.h" 10 #include "base/base_switches.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 base::PLATFORM_FILE_ENUMERATE); 227 base::PLATFORM_FILE_ENUMERATE);
228 // This is so that we can rename the old sandbox out of the way so that 228 // This is so that we can rename the old sandbox out of the way so that
229 // we know we've taken care of it. 229 // we know we've taken care of it.
230 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( 230 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile(
231 id(), resource_context_->file_system_context()-> 231 id(), resource_context_->file_system_context()->
232 path_manager()->sandbox_provider()->renamed_old_base_path(), 232 path_manager()->sandbox_provider()->renamed_old_base_path(),
233 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_CREATE_ALWAYS | 233 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_CREATE_ALWAYS |
234 base::PLATFORM_FILE_WRITE); 234 base::PLATFORM_FILE_WRITE);
235 } 235 }
236 236
237 // Call the embedder first so that their IPC filters have priority.
238 content::GetContentClient()->browser()->WorkerProcessHostCreated(this);
239 CreateMessageFilters(render_process_id); 237 CreateMessageFilters(render_process_id);
240 238
241 return true; 239 return true;
242 } 240 }
243 241
244 void WorkerProcessHost::CreateMessageFilters(int render_process_id) { 242 void WorkerProcessHost::CreateMessageFilters(int render_process_id) {
245 DCHECK(resource_context_); 243 DCHECK(resource_context_);
246 net::URLRequestContext* request_context = 244 net::URLRequestContext* request_context =
247 resource_context_->request_context(); 245 resource_context_->request_context();
248 246
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 364 }
367 } 365 }
368 } 366 }
369 367
370 void WorkerProcessHost::OnAllowDatabase(int worker_route_id, 368 void WorkerProcessHost::OnAllowDatabase(int worker_route_id,
371 const GURL& url, 369 const GURL& url,
372 const string16& name, 370 const string16& name,
373 const string16& display_name, 371 const string16& display_name,
374 unsigned long estimated_size, 372 unsigned long estimated_size,
375 bool* result) { 373 bool* result) {
376 *result = true; 374 *result = content::GetContentClient()->browser()->AllowWorkerDatabase(
375 worker_route_id, url, name, display_name, estimated_size, this);
377 } 376 }
378 377
379 void WorkerProcessHost::OnAllowFileSystem(int worker_route_id, 378 void WorkerProcessHost::OnAllowFileSystem(int worker_route_id,
380 const GURL& url, 379 const GURL& url,
381 bool* result) { 380 bool* result) {
382 *result = true; 381 *result = content::GetContentClient()->browser()->AllowWorkerFileSystem(
382 worker_route_id, url, this);
383 } 383 }
384 384
385 void WorkerProcessHost::RelayMessage( 385 void WorkerProcessHost::RelayMessage(
386 const IPC::Message& message, 386 const IPC::Message& message,
387 WorkerMessageFilter* filter, 387 WorkerMessageFilter* filter,
388 int route_id) { 388 int route_id) {
389 if (message.type() == WorkerMsg_PostMessage::ID) { 389 if (message.type() == WorkerMsg_PostMessage::ID) {
390 // We want to send the receiver a routing id for the new channel, so 390 // We want to send the receiver a routing id for the new channel, so
391 // crack the message first. 391 // crack the message first.
392 string16 msg; 392 string16 msg;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 if (i->worker_document_set()->IsEmpty()) { 507 if (i->worker_document_set()->IsEmpty()) {
508 // This worker has no more associated documents - shut it down. 508 // This worker has no more associated documents - shut it down.
509 Send(new WorkerMsg_TerminateWorkerContext(i->worker_route_id())); 509 Send(new WorkerMsg_TerminateWorkerContext(i->worker_route_id()));
510 i = instances_.erase(i); 510 i = instances_.erase(i);
511 } else { 511 } else {
512 ++i; 512 ++i;
513 } 513 }
514 } 514 }
515 } 515 }
516 516
517 void WorkerProcessHost::TerminateWorker(int worker_route_id) {
518 Send(new WorkerMsg_TerminateWorkerContext(worker_route_id));
519 }
520
517 WorkerProcessHost::WorkerInstance::WorkerInstance( 521 WorkerProcessHost::WorkerInstance::WorkerInstance(
518 const GURL& url, 522 const GURL& url,
519 const string16& name, 523 const string16& name,
520 int worker_route_id, 524 int worker_route_id,
521 int parent_process_id, 525 int parent_process_id,
522 int64 main_resource_appcache_id, 526 int64 main_resource_appcache_id,
523 const content::ResourceContext* resource_context) 527 const content::ResourceContext* resource_context)
524 : url_(url), 528 : url_(url),
525 closed_(false), 529 closed_(false),
526 name_(name), 530 name_(name),
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 } 634 }
631 } 635 }
632 return false; 636 return false;
633 } 637 }
634 638
635 WorkerProcessHost::WorkerInstance::FilterInfo 639 WorkerProcessHost::WorkerInstance::FilterInfo
636 WorkerProcessHost::WorkerInstance::GetFilter() const { 640 WorkerProcessHost::WorkerInstance::GetFilter() const {
637 DCHECK(NumFilters() == 1); 641 DCHECK(NumFilters() == 1);
638 return *filters_.begin(); 642 return *filters_.begin();
639 } 643 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698