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

Side by Side Diff: content/browser/shared_worker/shared_worker_instance.cc

Issue 2604733002: SharedWorker: Make shared workers keyed by a pair of url and name (Closed)
Patch Set: clean up Created 3 years, 12 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
« no previous file with comments | « no previous file | content/browser/shared_worker/shared_worker_instance_unittest.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/shared_worker/shared_worker_instance.h" 5 #include "content/browser/shared_worker/shared_worker_instance.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace content { 9 namespace content {
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 return false; 50 return false;
51 51
52 // We must be in the same storage partition otherwise sharing will violate 52 // We must be in the same storage partition otherwise sharing will violate
53 // isolation. 53 // isolation.
54 if (!partition_id_.Equals(partition_id)) 54 if (!partition_id_.Equals(partition_id))
55 return false; 55 return false;
56 56
57 if (url_.GetOrigin() != match_url.GetOrigin()) 57 if (url_.GetOrigin() != match_url.GetOrigin())
58 return false; 58 return false;
59 59
60 if (name_.empty() && match_name.empty()) 60 if (name_ != match_name || url_ != match_url)
61 return url_ == match_url; 61 return false;
62 62 return true;
63 return name_ == match_name;
64 } 63 }
65 64
66 bool SharedWorkerInstance::Matches(const SharedWorkerInstance& other) const { 65 bool SharedWorkerInstance::Matches(const SharedWorkerInstance& other) const {
67 return Matches(other.url(), 66 return Matches(other.url(),
68 other.name(), 67 other.name(),
69 other.partition_id(), 68 other.partition_id(),
70 other.resource_context()); 69 other.resource_context());
71 } 70 }
72 71
73 } // namespace content 72 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/shared_worker/shared_worker_instance_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698