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

Unified Diff: content/browser/shared_worker/shared_worker_instance.cc

Issue 196503005: Make DevTools support for the embedded SharedWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename Worker*OnUI to NotifyWorker*OnUI Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/shared_worker/shared_worker_instance.cc
diff --git a/content/browser/shared_worker/shared_worker_instance.cc b/content/browser/shared_worker/shared_worker_instance.cc
index a55dd918152761871ea6aa06de5f4e7c0ce82ed7..3d7bba5ebda8ce259185ee12bdbf391ed2d2cd18 100644
--- a/content/browser/shared_worker/shared_worker_instance.cc
+++ b/content/browser/shared_worker/shared_worker_instance.cc
@@ -46,7 +46,7 @@ void SharedWorkerInstance::SetMessagePortID(
bool SharedWorkerInstance::Matches(const GURL& match_url,
const base::string16& match_name,
const WorkerStoragePartition& partition,
- ResourceContext* resource_context) const {
+ ResourceContext* resource_context) const {
// Only match open shared workers.
if (closed_)
return false;
@@ -61,13 +61,21 @@ bool SharedWorkerInstance::Matches(const GURL& match_url,
if (!partition_.Equals(partition))
return false;
- if (url_.GetOrigin() != match_url.GetOrigin())
+ return UrlNameMatches(url_, name_, match_url, match_name);
+}
+
+// static
+bool SharedWorkerInstance::UrlNameMatches(const GURL& url1,
+ const base::string16& name1,
+ const GURL& url2,
+ const base::string16& name2) {
+ if (url1.GetOrigin() != url2.GetOrigin())
return false;
- if (name_.empty() && match_name.empty())
- return url_ == match_url;
+ if (name1.empty() && name2.empty())
+ return url1 == url2;
- return name_ == match_name;
+ return name1 == name2;
}
void SharedWorkerInstance::AddFilter(SharedWorkerMessageFilter* filter,

Powered by Google App Engine
This is Rietveld 408576698