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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 for (PendingConnectInfoList::const_iterator iter = pending_connects_.begin(); | 100 for (PendingConnectInfoList::const_iterator iter = pending_connects_.begin(); |
101 iter != pending_connects_.end(); | 101 iter != pending_connects_.end(); |
102 ++iter) { | 102 ++iter) { |
103 OnConnect(iter->first, iter->second); | 103 OnConnect(iter->first, iter->second); |
104 } | 104 } |
105 pending_connects_.clear(); | 105 pending_connects_.clear(); |
106 } | 106 } |
107 | 107 |
108 void WebSharedWorkerStub::OnConnect(int sent_message_port_id, int routing_id) { | 108 void WebSharedWorkerStub::OnConnect(int sent_message_port_id, int routing_id) { |
109 if (started_) { | 109 if (started_) { |
110 WebKit::WebMessagePortChannel* channel = new WebMessagePortChannelImpl( | 110 WebKit::WebMessagePortChannel* channel = |
111 routing_id, sent_message_port_id, base::MessageLoopProxy::current()); | 111 new WebMessagePortChannelImpl(routing_id, |
| 112 sent_message_port_id, |
| 113 base::MessageLoopProxy::current().get()); |
112 impl_->connect(channel, NULL); | 114 impl_->connect(channel, NULL); |
113 } else { | 115 } else { |
114 // If two documents try to load a SharedWorker at the same time, the | 116 // If two documents try to load a SharedWorker at the same time, the |
115 // WorkerMsg_Connect for one of the documents can come in before the | 117 // WorkerMsg_Connect for one of the documents can come in before the |
116 // worker is started. Just queue up the connect and deliver it once the | 118 // worker is started. Just queue up the connect and deliver it once the |
117 // worker starts. | 119 // worker starts. |
118 PendingConnectInfo pending_connect(sent_message_port_id, routing_id); | 120 PendingConnectInfo pending_connect(sent_message_port_id, routing_id); |
119 pending_connects_.push_back(pending_connect); | 121 pending_connects_.push_back(pending_connect); |
120 } | 122 } |
121 } | 123 } |
122 | 124 |
123 void WebSharedWorkerStub::OnTerminateWorkerContext() { | 125 void WebSharedWorkerStub::OnTerminateWorkerContext() { |
124 impl_->terminateWorkerContext(); | 126 impl_->terminateWorkerContext(); |
125 | 127 |
126 // Call the client to make sure context exits. | 128 // Call the client to make sure context exits. |
127 EnsureWorkerContextTerminates(); | 129 EnsureWorkerContextTerminates(); |
128 started_ = false; | 130 started_ = false; |
129 } | 131 } |
130 | 132 |
131 } // namespace content | 133 } // namespace content |
OLD | NEW |