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

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

Issue 125513002: Finally remove ResourceRequestInfo::GetAssociatedRenderView. Also remove the shared worker plumbing… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/worker_host/worker_service_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_impl.h" 5 #include "content/browser/worker_host/worker_service_impl.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"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 params.url, 313 params.url,
314 params.name, 314 params.name,
315 next_worker_route_id(), 315 next_worker_route_id(),
316 0, 316 0,
317 params.script_resource_appcache_id, 317 params.script_resource_appcache_id,
318 resource_context, 318 resource_context,
319 partition); 319 partition);
320 instance.AddFilter(filter, route_id); 320 instance.AddFilter(filter, route_id);
321 instance.worker_document_set()->Add( 321 instance.worker_document_set()->Add(
322 filter, params.document_id, filter->render_process_id(), 322 filter, params.document_id, filter->render_process_id(),
323 params.render_view_route_id, params.render_frame_route_id); 323 params.render_frame_route_id);
324 324
325 CreateWorkerFromInstance(instance); 325 CreateWorkerFromInstance(instance);
326 } 326 }
327 327
328 void WorkerServiceImpl::LookupSharedWorker( 328 void WorkerServiceImpl::LookupSharedWorker(
329 const ViewHostMsg_CreateWorker_Params& params, 329 const ViewHostMsg_CreateWorker_Params& params,
330 int route_id, 330 int route_id,
331 WorkerMessageFilter* filter, 331 WorkerMessageFilter* filter,
332 ResourceContext* resource_context, 332 ResourceContext* resource_context,
333 const WorkerStoragePartition& partition, 333 const WorkerStoragePartition& partition,
(...skipping 24 matching lines...) Expand all
358 // Add our route ID to the existing instance so we can send messages to it. 358 // Add our route ID to the existing instance so we can send messages to it.
359 instance->AddFilter(filter, route_id); 359 instance->AddFilter(filter, route_id);
360 360
361 // Add the passed filter/document_id to the worker instance. 361 // Add the passed filter/document_id to the worker instance.
362 // TODO(atwilson): This won't work if the message is from a worker process. 362 // TODO(atwilson): This won't work if the message is from a worker process.
363 // We don't support that yet though (this message is only sent from 363 // We don't support that yet though (this message is only sent from
364 // renderers) but when we do, we'll need to add code to pass in the current 364 // renderers) but when we do, we'll need to add code to pass in the current
365 // worker's document set for nested workers. 365 // worker's document set for nested workers.
366 instance->worker_document_set()->Add( 366 instance->worker_document_set()->Add(
367 filter, params.document_id, filter->render_process_id(), 367 filter, params.document_id, filter->render_process_id(),
368 params.render_view_route_id, params.render_frame_route_id); 368 params.render_frame_route_id);
369 } 369 }
370 } 370 }
371 371
372 void WorkerServiceImpl::ForwardToWorker(const IPC::Message& message, 372 void WorkerServiceImpl::ForwardToWorker(const IPC::Message& message,
373 WorkerMessageFilter* filter) { 373 WorkerMessageFilter* filter) {
374 for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) { 374 for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) {
375 if (iter->FilterMessage(message, filter)) 375 if (iter->FilterMessage(message, filter))
376 return; 376 return;
377 } 377 }
378 378
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 // rare in practice so the list will be small. 572 // rare in practice so the list will be small.
573 i = queued_workers_.begin(); 573 i = queued_workers_.begin();
574 } else { 574 } else {
575 ++i; 575 ++i;
576 } 576 }
577 } 577 }
578 } 578 }
579 579
580 bool WorkerServiceImpl::GetRendererForWorker(int worker_process_id, 580 bool WorkerServiceImpl::GetRendererForWorker(int worker_process_id,
581 int* render_process_id, 581 int* render_process_id,
582 int* render_view_id,
583 int* render_frame_id) const { 582 int* render_frame_id) const {
584 for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) { 583 for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) {
585 if (iter.GetData().id != worker_process_id) 584 if (iter.GetData().id != worker_process_id)
586 continue; 585 continue;
587 586
588 // This code assumes one worker per process, see function comment in header! 587 // This code assumes one worker per process, see function comment in header!
589 WorkerProcessHost::Instances::const_iterator first_instance = 588 WorkerProcessHost::Instances::const_iterator first_instance =
590 iter->instances().begin(); 589 iter->instances().begin();
591 if (first_instance == iter->instances().end()) 590 if (first_instance == iter->instances().end())
592 return false; 591 return false;
593 592
594 WorkerDocumentSet::DocumentInfoSet::const_iterator info = 593 WorkerDocumentSet::DocumentInfoSet::const_iterator info =
595 first_instance->worker_document_set()->documents().begin(); 594 first_instance->worker_document_set()->documents().begin();
596 *render_process_id = info->render_process_id(); 595 *render_process_id = info->render_process_id();
597 *render_view_id = info->render_view_id();
598 *render_frame_id = info->render_frame_id(); 596 *render_frame_id = info->render_frame_id();
599 return true; 597 return true;
600 } 598 }
601 return false; 599 return false;
602 } 600 }
603 601
604 const WorkerProcessHost::WorkerInstance* WorkerServiceImpl::FindWorkerInstance( 602 const WorkerProcessHost::WorkerInstance* WorkerServiceImpl::FindWorkerInstance(
605 int worker_process_id) { 603 int worker_process_id) {
606 for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) { 604 for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) {
607 if (iter.GetData().id != worker_process_id) 605 if (iter.GetData().id != worker_process_id)
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 return instance; 726 return instance;
729 727
730 // No existing pending worker - create a new one. 728 // No existing pending worker - create a new one.
731 WorkerProcessHost::WorkerInstance pending( 729 WorkerProcessHost::WorkerInstance pending(
732 url, true, name, resource_context, partition); 730 url, true, name, resource_context, partition);
733 pending_shared_workers_.push_back(pending); 731 pending_shared_workers_.push_back(pending);
734 return &pending_shared_workers_.back(); 732 return &pending_shared_workers_.back();
735 } 733 }
736 734
737 } // namespace content 735 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/worker_host/worker_service_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698