summaryrefslogtreecommitdiffstats
path: root/WebCore/workers/DefaultSharedWorkerRepository.h
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/workers/DefaultSharedWorkerRepository.h')
-rw-r--r--WebCore/workers/DefaultSharedWorkerRepository.h28
1 files changed, 18 insertions, 10 deletions
diff --git a/WebCore/workers/DefaultSharedWorkerRepository.h b/WebCore/workers/DefaultSharedWorkerRepository.h
index 0b4e66c..c2eaff4 100644
--- a/WebCore/workers/DefaultSharedWorkerRepository.h
+++ b/WebCore/workers/DefaultSharedWorkerRepository.h
@@ -33,22 +33,24 @@
#if ENABLE(SHARED_WORKERS)
-#include "SharedWorkerRepository.h"
+#include "ExceptionCode.h"
#include "StringHash.h"
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Threading.h>
namespace WebCore {
+ class Document;
class KURL;
+ class MessagePortChannel;
class ScriptExecutionContext;
- class SecurityOrigin;
+ class SharedWorker;
class SharedWorkerProxy;
-
- struct SecurityOriginHash;
- struct SecurityOriginTraits;
+ class String;
// Platform-specific implementation of the SharedWorkerRepository static interface.
class DefaultSharedWorkerRepository : public Noncopyable {
@@ -59,6 +61,14 @@ namespace WebCore {
// Internal implementation of SharedWorkerRepository::connect()
void connectToWorker(PassRefPtr<SharedWorker>, PassOwnPtr<MessagePortChannel>, const KURL&, const String& name, ExceptionCode&);
+ // Notification that a document has been detached.
+ void documentDetached(Document*);
+
+ // Removes the passed SharedWorkerProxy from the repository.
+ void removeProxy(SharedWorkerProxy*);
+
+ bool hasSharedWorkers(Document*);
+
static DefaultSharedWorkerRepository& instance();
private:
DefaultSharedWorkerRepository();
@@ -68,11 +78,9 @@ namespace WebCore {
// Mutex used to protect internal data structures.
Mutex m_lock;
- typedef HashMap<String, RefPtr<SharedWorkerProxy> > SharedWorkerNameMap;
- typedef HashMap<RefPtr<SecurityOrigin>, SharedWorkerNameMap*, SecurityOriginHash> SharedWorkerProxyCache;
-
- // Items in this cache may be freed on another thread, so all keys and values must be either copied before insertion or thread safe.
- SharedWorkerProxyCache m_cache;
+ // List of shared workers. Expectation is that there will be a limited number of shared workers, and so tracking them in a Vector is more efficient than nested HashMaps.
+ typedef Vector<RefPtr<SharedWorkerProxy> > SharedWorkerProxyRepository;
+ SharedWorkerProxyRepository m_proxies;
};
} // namespace WebCore