[email protected] | ab350536 | 2009-10-30 18:11:47 | [diff] [blame] | 1 | // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 | // source code is governed by a BSD-style license that can be found in the | ||||
3 | // LICENSE file. | ||||
4 | |||||
[email protected] | 6f51608 | 2011-03-17 19:15:35 | [diff] [blame] | 5 | #include "content/renderer/websharedworkerrepository_impl.h" |
[email protected] | ab350536 | 2009-10-30 18:11:47 | [diff] [blame] | 6 | |
[email protected] | f1a29a0 | 2011-10-06 23:08:44 | [diff] [blame] | 7 | #include "content/common/child_thread.h" |
[email protected] | 59f4f2fa | 2011-03-23 01:00:55 | [diff] [blame] | 8 | #include "content/common/view_messages.h" |
[email protected] | 6f51608 | 2011-03-17 19:15:35 | [diff] [blame] | 9 | #include "content/renderer/websharedworker_proxy.h" |
[email protected] | 9c00f00 | 2009-11-05 22:37:42 | [diff] [blame] | 10 | |
[email protected] | eb39819 | 2012-10-22 20:16:19 | [diff] [blame] | 11 | namespace content { |
12 | |||||
[email protected] | 38e0898 | 2010-10-22 17:28:43 | [diff] [blame] | 13 | WebSharedWorkerRepositoryImpl::WebSharedWorkerRepositoryImpl() {} |
14 | |||||
15 | WebSharedWorkerRepositoryImpl::~WebSharedWorkerRepositoryImpl() {} | ||||
16 | |||||
[email protected] | 9c00f00 | 2009-11-05 22:37:42 | [diff] [blame] | 17 | void WebSharedWorkerRepositoryImpl::addSharedWorker( |
18 | WebKit::WebSharedWorker* worker, DocumentID document) { | ||||
[email protected] | 30447b6 | 2009-11-13 01:13:37 | [diff] [blame] | 19 | shared_worker_parents_.insert(document); |
[email protected] | ab350536 | 2009-10-30 18:11:47 | [diff] [blame] | 20 | } |
21 | |||||
[email protected] | 30447b6 | 2009-11-13 01:13:37 | [diff] [blame] | 22 | void WebSharedWorkerRepositoryImpl::documentDetached(DocumentID document) { |
23 | DocumentSet::iterator iter = shared_worker_parents_.find(document); | ||||
24 | if (iter != shared_worker_parents_.end()) { | ||||
25 | // Notify the browser process that the document has shut down. | ||||
26 | ChildThread::current()->Send(new ViewHostMsg_DocumentDetached(document)); | ||||
27 | shared_worker_parents_.erase(iter); | ||||
28 | } | ||||
[email protected] | ab350536 | 2009-10-30 18:11:47 | [diff] [blame] | 29 | } |
30 | |||||
[email protected] | 30447b6 | 2009-11-13 01:13:37 | [diff] [blame] | 31 | bool WebSharedWorkerRepositoryImpl::hasSharedWorkers(DocumentID document) { |
32 | return shared_worker_parents_.find(document) != shared_worker_parents_.end(); | ||||
[email protected] | ab350536 | 2009-10-30 18:11:47 | [diff] [blame] | 33 | } |
[email protected] | eb39819 | 2012-10-22 20:16:19 | [diff] [blame] | 34 | |
35 | } // namespace content |