Chromium Code Reviews| Index: content/browser/worker_host/shared_worker_document_set.h |
| diff --git a/content/browser/worker_host/worker_document_set.h b/content/browser/worker_host/shared_worker_document_set.h |
| similarity index 59% |
| copy from content/browser/worker_host/worker_document_set.h |
| copy to content/browser/worker_host/shared_worker_document_set.h |
| index bec81e870dec65f1dbca6b47b4efff2bf96a292a..adff6cb42a5b203887f60d1178c9925e30526099 100644 |
| --- a/content/browser/worker_host/worker_document_set.h |
| +++ b/content/browser/worker_host/shared_worker_document_set.h |
| @@ -1,9 +1,9 @@ |
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef CONTENT_BROWSER_WORKER_HOST_WORKER_DOCUMENT_SET_H_ |
| -#define CONTENT_BROWSER_WORKER_HOST_WORKER_DOCUMENT_SET_H_ |
| +#ifndef CONTENT_BROWSER_WORKER_HOST_SHARED_WORKER_DOCUMENT_SET_H_ |
| +#define CONTENT_BROWSER_WORKER_HOST_SHARED_WORKER_DOCUMENT_SET_H_ |
| #include <set> |
| @@ -11,22 +11,28 @@ |
| #include "base/memory/ref_counted.h" |
| namespace content { |
|
kinuko
2014/02/12 08:09:49
nit: not mandatory or not in our style guide, but
|
| -class WorkerMessageFilter; |
| +class SharedWorkerMessageFilter; |
| -// The WorkerDocumentSet tracks all of the DOM documents associated with a |
| +// The SharedWorkerDocumentSet tracks all of the DOM documents associated with a |
| // set of workers. With nested workers, multiple workers can share the same |
| -// WorkerDocumentSet (meaning that they all share the same lifetime, and will |
| -// all exit when the last document in that set exits, per the WebWorkers spec). |
| -class WorkerDocumentSet : public base::RefCounted<WorkerDocumentSet> { |
| +// SharedWorkerDocumentSet (meaning that they all share the same lifetime, and |
| +// willall exit when the last document in that set exits, per the WebWorkers |
|
kinuko
2014/02/12 08:09:49
willall -> will all
|
| +// spec). |
| +// If "enable-embedded-shared-worker" is set this class will be used in stead of |
|
kinuko
2014/02/12 08:09:49
nit: 'in stead of' works, but 'instead of' might b
|
| +// SharedWorkerDocument. |
| +class SharedWorkerDocumentSet |
|
kinuko
2014/02/12 08:09:49
This class's mostly same as WorkerDocumentSet-- ca
|
| + : public base::RefCounted<SharedWorkerDocumentSet> { |
| public: |
| - WorkerDocumentSet(); |
| + SharedWorkerDocumentSet(); |
| // The information we track for each document |
| class DocumentInfo { |
| public: |
| - DocumentInfo(WorkerMessageFilter* filter, unsigned long long document_id, |
| - int renderer_process_id, int render_frame_id); |
| - WorkerMessageFilter* filter() const { return filter_; } |
| + DocumentInfo(SharedWorkerMessageFilter* filter, |
| + unsigned long long document_id, |
| + int renderer_process_id, |
| + int render_frame_id); |
| + SharedWorkerMessageFilter* filter() const { return filter_; } |
| unsigned long long document_id() const { return document_id_; } |
| int render_process_id() const { return render_process_id_; } |
| int render_frame_id() const { return render_frame_id_; } |
| @@ -46,7 +52,7 @@ class WorkerDocumentSet : public base::RefCounted<WorkerDocumentSet> { |
| } |
| private: |
| - WorkerMessageFilter* filter_; |
| + SharedWorkerMessageFilter* filter_; |
| unsigned long long document_id_; |
| int render_process_id_; |
| int render_frame_id_; |
| @@ -55,22 +61,27 @@ class WorkerDocumentSet : public base::RefCounted<WorkerDocumentSet> { |
| // Adds a document to a shared worker's document set. Also includes the |
| // associated render_process_id the document is associated with, to enable |
| // communication with the parent tab for things like http auth dialogs. |
| - void Add(WorkerMessageFilter* parent, |
| + void Add(SharedWorkerMessageFilter* parent, |
| unsigned long long document_id, |
| int render_process_id, |
| int render_frame_id); |
| // Checks to see if a document is in a shared worker's document set. |
| - bool Contains(WorkerMessageFilter* parent, |
| + bool Contains(SharedWorkerMessageFilter* parent, |
| unsigned long long document_id) const; |
| + // Checks to see if the document set contains any documents which are |
| + // associated with other renderer process than worker_process_id. |
| + bool ContainsExternalRenderer(int worker_process_id) const; |
| + |
| // Removes a specific document from a worker's document set when that document |
| // is detached. |
| - void Remove(WorkerMessageFilter* parent, unsigned long long document_id); |
| + void Remove(SharedWorkerMessageFilter* parent, |
| + unsigned long long document_id); |
| // Invoked when a render process exits, to remove all associated documents |
| // from a worker's document set. |
| - void RemoveAll(WorkerMessageFilter* parent); |
| + void RemoveAll(SharedWorkerMessageFilter* parent); |
| bool IsEmpty() const { return document_set_.empty(); } |
| @@ -81,12 +92,12 @@ class WorkerDocumentSet : public base::RefCounted<WorkerDocumentSet> { |
| const DocumentInfoSet& documents() { return document_set_; } |
| private: |
| - friend class base::RefCounted<WorkerDocumentSet>; |
| - virtual ~WorkerDocumentSet(); |
| + friend class base::RefCounted<SharedWorkerDocumentSet>; |
| + virtual ~SharedWorkerDocumentSet(); |
| DocumentInfoSet document_set_; |
| }; |
| } // namespace content |
| -#endif // CONTENT_BROWSER_WORKER_HOST_WORKER_DOCUMENT_SET_H_ |
| +#endif // CONTENT_BROWSER_WORKER_HOST_SHARED_WORKER_DOCUMENT_SET_H_ |