summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/websharedworkerrepository_impl.cc
blob: 99f2a3bda2613366d2269dd31a798216ba3ef82e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright (c) 2009 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.

#include "chrome/renderer/websharedworkerrepository_impl.h"

#include "chrome/common/render_messages.h"
#include "chrome/renderer/render_thread.h"
#include "chrome/renderer/websharedworker_proxy.h"

void WebSharedWorkerRepositoryImpl::addSharedWorker(
    WebKit::WebSharedWorker* worker, DocumentID document) {
  shared_worker_parents_.insert(document);
}

void WebSharedWorkerRepositoryImpl::documentDetached(DocumentID document) {
  DocumentSet::iterator iter = shared_worker_parents_.find(document);
  if (iter != shared_worker_parents_.end()) {
    // Notify the browser process that the document has shut down.
    ChildThread::current()->Send(new ViewHostMsg_DocumentDetached(document));
    shared_worker_parents_.erase(iter);
  }
}

bool WebSharedWorkerRepositoryImpl::hasSharedWorkers(DocumentID document) {
  return shared_worker_parents_.find(document) != shared_worker_parents_.end();
}