OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "webkit/tools/test_shell/simple_socket_stream_bridge.h" | 7 #include "webkit/tools/test_shell/simple_socket_stream_bridge.h" |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // Release socket_ on IO thread. | 149 // Release socket_ on IO thread. |
150 socket_ = NULL; | 150 socket_ = NULL; |
151 socket_id_ = kNoSocketId; | 151 socket_id_ = kNoSocketId; |
152 message_loop_->PostTask( | 152 message_loop_->PostTask( |
153 FROM_HERE, | 153 FROM_HERE, |
154 NewRunnableMethod(this, &WebSocketStreamHandleBridgeImpl::DoOnClose)); | 154 NewRunnableMethod(this, &WebSocketStreamHandleBridgeImpl::DoOnClose)); |
155 } | 155 } |
156 | 156 |
157 void WebSocketStreamHandleBridgeImpl::DoConnect(const GURL& url) { | 157 void WebSocketStreamHandleBridgeImpl::DoConnect(const GURL& url) { |
158 DCHECK(MessageLoop::current() == g_io_thread); | 158 DCHECK(MessageLoop::current() == g_io_thread); |
159 socket_ = net::SocketStreamJob::CreateSocketStreamJob(url, this); | 159 socket_ = net::SocketStreamJob::CreateSocketStreamJob( |
| 160 url, this, *g_request_context); |
160 socket_->set_context(g_request_context); | 161 socket_->set_context(g_request_context); |
161 socket_->Connect(); | 162 socket_->Connect(); |
162 } | 163 } |
163 | 164 |
164 void WebSocketStreamHandleBridgeImpl::DoSend(std::vector<char>* data) { | 165 void WebSocketStreamHandleBridgeImpl::DoSend(std::vector<char>* data) { |
165 DCHECK(MessageLoop::current() == g_io_thread); | 166 DCHECK(MessageLoop::current() == g_io_thread); |
166 scoped_ptr<std::vector<char> > scoped_data(data); | 167 scoped_ptr<std::vector<char> > scoped_data(data); |
167 if (!socket_) | 168 if (!socket_) |
168 return; | 169 return; |
169 if (!socket_->SendData(&(data->at(0)), data->size())) | 170 if (!socket_->SendData(&(data->at(0)), data->size())) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 namespace webkit_glue { | 233 namespace webkit_glue { |
233 | 234 |
234 /* static */ | 235 /* static */ |
235 WebSocketStreamHandleBridge* WebSocketStreamHandleBridge::Create( | 236 WebSocketStreamHandleBridge* WebSocketStreamHandleBridge::Create( |
236 WebKit::WebSocketStreamHandle* handle, | 237 WebKit::WebSocketStreamHandle* handle, |
237 WebSocketStreamHandleDelegate* delegate) { | 238 WebSocketStreamHandleDelegate* delegate) { |
238 return new WebSocketStreamHandleBridgeImpl(handle, delegate); | 239 return new WebSocketStreamHandleBridgeImpl(handle, delegate); |
239 } | 240 } |
240 | 241 |
241 } // namespace webkit_glue | 242 } // namespace webkit_glue |
OLD | NEW |