summaryrefslogtreecommitdiffstats
path: root/content/renderer/websharedworkerrepository_impl.h
blob: 4263c8e97d9e536f4e5ce5150bac58e9958afc20 (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
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2012 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_RENDERER_WEBSHAREDWORKERREPOSITORY_IMPL_H_
#define CONTENT_RENDERER_WEBSHAREDWORKERREPOSITORY_IMPL_H_

#include "third_party/WebKit/Source/WebKit/chromium/public/WebSharedWorkerRepository.h"

#include "base/hash_tables.h"

namespace WebKit {
class WebSharedWorker;
}

namespace content {

class WebSharedWorkerRepositoryImpl : public WebKit::WebSharedWorkerRepository {
 public:
  WebSharedWorkerRepositoryImpl();
  virtual ~WebSharedWorkerRepositoryImpl();

  virtual void addSharedWorker(WebKit::WebSharedWorker*, DocumentID document);
  virtual void documentDetached(DocumentID document);

  // Returns true if the document has created a SharedWorker (used by the
  // WebKit code to determine if the document can be suspended).
  virtual bool hasSharedWorkers(DocumentID document);

 private:
  // The set of documents that have created a SharedWorker.
  typedef base::hash_set<DocumentID> DocumentSet;
  DocumentSet shared_worker_parents_;
};

}  // namespace content

#endif  // CONTENT_RENDERER_WEBSHAREDWORKERREPOSITORY_IMPL_H_