OLD | NEW |
1 // Copyright (c) 2011 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" |
11 #include "base/sys_info.h" | 11 #include "base/sys_info.h" |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 ++i; | 419 ++i; |
420 } | 420 } |
421 } | 421 } |
422 } | 422 } |
423 | 423 |
424 bool WorkerServiceImpl::GetRendererForWorker(int worker_process_id, | 424 bool WorkerServiceImpl::GetRendererForWorker(int worker_process_id, |
425 int* render_process_id, | 425 int* render_process_id, |
426 int* render_view_id) const { | 426 int* render_view_id) const { |
427 for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) { | 427 for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) { |
428 if (iter.GetData().id != worker_process_id) | 428 if (iter.GetData().id != worker_process_id) |
429 continue; | 429 continue; |
430 | 430 |
431 // This code assumes one worker per process, see function comment in header! | 431 // This code assumes one worker per process, see function comment in header! |
432 WorkerProcessHost::Instances::const_iterator first_instance = | 432 WorkerProcessHost::Instances::const_iterator first_instance = |
433 iter->instances().begin(); | 433 iter->instances().begin(); |
434 if (first_instance == iter->instances().end()) | 434 if (first_instance == iter->instances().end()) |
435 return false; | 435 return false; |
436 | 436 |
437 WorkerDocumentSet::DocumentInfoSet::const_iterator info = | 437 WorkerDocumentSet::DocumentInfoSet::const_iterator info = |
438 first_instance->worker_document_set()->documents().begin(); | 438 first_instance->worker_document_set()->documents().begin(); |
439 *render_process_id = info->render_process_id(); | 439 *render_process_id = info->render_process_id(); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 if (instance) | 562 if (instance) |
563 return instance; | 563 return instance; |
564 | 564 |
565 // No existing pending worker - create a new one. | 565 // No existing pending worker - create a new one. |
566 WorkerProcessHost::WorkerInstance pending(url, true, name, resource_context); | 566 WorkerProcessHost::WorkerInstance pending(url, true, name, resource_context); |
567 pending_shared_workers_.push_back(pending); | 567 pending_shared_workers_.push_back(pending); |
568 return &pending_shared_workers_.back(); | 568 return &pending_shared_workers_.back(); |
569 } | 569 } |
570 | 570 |
571 } // namespace content | 571 } // namespace content |
OLD | NEW |