Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_process_host.h" | 5 #include "content/browser/worker_host/worker_process_host.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 615 // -or- | 615 // -or- |
| 616 // b) the names are both empty, and the urls are equal | 616 // b) the names are both empty, and the urls are equal |
| 617 bool WorkerProcessHost::WorkerInstance::Matches( | 617 bool WorkerProcessHost::WorkerInstance::Matches( |
| 618 const GURL& match_url, | 618 const GURL& match_url, |
| 619 const string16& match_name, | 619 const string16& match_name, |
| 620 content::ResourceContext* resource_context) const { | 620 content::ResourceContext* resource_context) const { |
| 621 // Only match open shared workers. | 621 // Only match open shared workers. |
| 622 if (closed_) | 622 if (closed_) |
| 623 return false; | 623 return false; |
| 624 | 624 |
| 625 // Have to match the same ResourceContext. | 625 // ResourceContext equivalence is being used as a proxy for ensure we only |
|
nasko
2012/06/29 23:08:56
nit: s/for/to/?
awong
2012/07/09 20:37:43
Done.
| |
| 626 // matched shared workers within the same BrowserContext. | |
| 626 if (resource_context_ != resource_context) | 627 if (resource_context_ != resource_context) |
| 627 return false; | 628 return false; |
| 628 | 629 |
| 629 if (url_.GetOrigin() != match_url.GetOrigin()) | 630 if (url_.GetOrigin() != match_url.GetOrigin()) |
| 630 return false; | 631 return false; |
| 631 | 632 |
| 632 if (name_.empty() && match_name.empty()) | 633 if (name_.empty() && match_name.empty()) |
| 633 return url_ == match_url; | 634 return url_ == match_url; |
| 634 | 635 |
| 635 return name_ == match_name; | 636 return name_ == match_name; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 689 } | 690 } |
| 690 } | 691 } |
| 691 return false; | 692 return false; |
| 692 } | 693 } |
| 693 | 694 |
| 694 WorkerProcessHost::WorkerInstance::FilterInfo | 695 WorkerProcessHost::WorkerInstance::FilterInfo |
| 695 WorkerProcessHost::WorkerInstance::GetFilter() const { | 696 WorkerProcessHost::WorkerInstance::GetFilter() const { |
| 696 DCHECK(NumFilters() == 1); | 697 DCHECK(NumFilters() == 1); |
| 697 return *filters_.begin(); | 698 return *filters_.begin(); |
| 698 } | 699 } |
| OLD | NEW |