OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 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 | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #include "chrome/renderer/websharedworkerrepository_impl.h" | 5 #include "chrome/renderer/websharedworkerrepository_impl.h" |
6 | 6 |
7 #include "chrome/common/render_messages.h" | |
8 #include "chrome/renderer/render_thread.h" | |
7 #include "chrome/renderer/websharedworker_proxy.h" | 9 #include "chrome/renderer/websharedworker_proxy.h" |
8 | 10 |
9 void WebSharedWorkerRepositoryImpl::addSharedWorker( | 11 void WebSharedWorkerRepositoryImpl::addSharedWorker( |
10 WebKit::WebSharedWorker* worker, DocumentID document) { | 12 WebKit::WebSharedWorker* worker, DocumentID document) { |
11 // TODO(atwilson): Track shared worker creation here. | 13 shared_worker_parents_.insert(document); |
12 } | 14 } |
13 | 15 |
14 void WebSharedWorkerRepositoryImpl::documentDetached( | 16 void WebSharedWorkerRepositoryImpl::documentDetached(DocumentID document) { |
15 DocumentID document) { | 17 DocumentSet::iterator iter = shared_worker_parents_.find(document); |
16 // TODO(atwilson): Update this to call to WorkerService to shutdown any | 18 if (iter != shared_worker_parents_.end()) { |
17 // associated SharedWorkers. | 19 // Notify the browser process that the document has shut down. |
20 RenderThread::current()->Send(new ViewHostMsg_DocumentDetached(document)); | |
jam
2009/11/12 20:11:23
nit: if you make this ChildThread::, this file can
| |
21 shared_worker_parents_.erase(iter); | |
22 } | |
18 } | 23 } |
19 | 24 |
20 bool WebSharedWorkerRepositoryImpl::hasSharedWorkers( | 25 bool WebSharedWorkerRepositoryImpl::hasSharedWorkers(DocumentID document) { |
21 DocumentID document) { | 26 return shared_worker_parents_.find(document) != shared_worker_parents_.end(); |
22 // TODO(atwilson): Update this when we track shared worker creation. | |
23 return false; | |
24 } | 27 } |
OLD | NEW |