OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/worker/websharedworker_stub.h" | 5 #include "content/worker/websharedworker_stub.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "content/child/child_process.h" | 8 #include "content/child/child_process.h" |
9 #include "content/child/child_thread.h" | 9 #include "content/child/child_thread.h" |
10 #include "content/child/fileapi/file_system_dispatcher.h" | 10 #include "content/child/fileapi/file_system_dispatcher.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 int route_id) | 26 int route_id) |
27 : route_id_(route_id), | 27 : route_id_(route_id), |
28 client_(route_id, this), | 28 client_(route_id, this), |
29 running_(false), | 29 running_(false), |
30 url_(url) { | 30 url_(url) { |
31 | 31 |
32 WorkerThread* worker_thread = WorkerThread::current(); | 32 WorkerThread* worker_thread = WorkerThread::current(); |
33 DCHECK(worker_thread); | 33 DCHECK(worker_thread); |
34 worker_thread->AddWorkerStub(this); | 34 worker_thread->AddWorkerStub(this); |
35 // Start processing incoming IPCs for this worker. | 35 // Start processing incoming IPCs for this worker. |
36 worker_thread->AddRoute(route_id_, this); | 36 worker_thread->GetRouter()->AddRoute(route_id_, this); |
37 | 37 |
38 // TODO(atwilson): Add support for NaCl when they support MessagePorts. | 38 // TODO(atwilson): Add support for NaCl when they support MessagePorts. |
39 impl_ = blink::WebSharedWorker::create(client()); | 39 impl_ = blink::WebSharedWorker::create(client()); |
40 worker_devtools_agent_.reset(new SharedWorkerDevToolsAgent(route_id, impl_)); | 40 worker_devtools_agent_.reset(new SharedWorkerDevToolsAgent(route_id, impl_)); |
41 client()->set_devtools_agent(worker_devtools_agent_.get()); | 41 client()->set_devtools_agent(worker_devtools_agent_.get()); |
42 impl_->startWorkerContext(url_, name, | 42 impl_->startWorkerContext(url_, name, |
43 content_security_policy, security_policy_type); | 43 content_security_policy, security_policy_type); |
44 } | 44 } |
45 | 45 |
46 WebSharedWorkerStub::~WebSharedWorkerStub() { | 46 WebSharedWorkerStub::~WebSharedWorkerStub() { |
47 impl_->clientDestroyed(); | 47 impl_->clientDestroyed(); |
48 WorkerThread* worker_thread = WorkerThread::current(); | 48 WorkerThread* worker_thread = WorkerThread::current(); |
49 DCHECK(worker_thread); | 49 DCHECK(worker_thread); |
50 worker_thread->RemoveWorkerStub(this); | 50 worker_thread->RemoveWorkerStub(this); |
51 worker_thread->RemoveRoute(route_id_); | 51 worker_thread->GetRouter()->RemoveRoute(route_id_); |
52 } | 52 } |
53 | 53 |
54 void WebSharedWorkerStub::Shutdown() { | 54 void WebSharedWorkerStub::Shutdown() { |
55 // The worker has exited - free ourselves and the client. | 55 // The worker has exited - free ourselves and the client. |
56 delete this; | 56 delete this; |
57 } | 57 } |
58 | 58 |
59 void WebSharedWorkerStub::EnsureWorkerContextTerminates() { | 59 void WebSharedWorkerStub::EnsureWorkerContextTerminates() { |
60 client_.EnsureWorkerContextTerminates(); | 60 client_.EnsureWorkerContextTerminates(); |
61 } | 61 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 iter != pending_channels_.end(); | 128 iter != pending_channels_.end(); |
129 ++iter) { | 129 ++iter) { |
130 blink::WebMessagePortChannel* channel = *iter; | 130 blink::WebMessagePortChannel* channel = *iter; |
131 channel->destroy(); | 131 channel->destroy(); |
132 } | 132 } |
133 pending_channels_.clear(); | 133 pending_channels_.clear(); |
134 Shutdown(); | 134 Shutdown(); |
135 } | 135 } |
136 | 136 |
137 } // namespace content | 137 } // namespace content |
OLD | NEW |