| 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/atomicops.h" | 9 #include "base/atomicops.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 delegate->DidClose(handle_); | 216 delegate->DidClose(handle_); |
| 217 Release(); | 217 Release(); |
| 218 } | 218 } |
| 219 | 219 |
| 220 } // namespace | 220 } // namespace |
| 221 | 221 |
| 222 /* static */ | 222 /* static */ |
| 223 void SimpleSocketStreamBridge::InitializeOnIOThread( | 223 void SimpleSocketStreamBridge::InitializeOnIOThread( |
| 224 net::URLRequestContext* request_context) { | 224 net::URLRequestContext* request_context) { |
| 225 g_io_thread = MessageLoop::current(); | 225 g_io_thread = MessageLoop::current(); |
| 226 if ((g_request_context = request_context)) | 226 g_request_context = request_context; |
| 227 g_request_context->AddRef(); | |
| 228 } | 227 } |
| 229 | 228 |
| 230 void SimpleSocketStreamBridge::Cleanup() { | 229 void SimpleSocketStreamBridge::Cleanup() { |
| 231 g_io_thread = NULL; | 230 g_io_thread = NULL; |
| 232 if (g_request_context) | |
| 233 g_request_context->Release(); | |
| 234 g_request_context = NULL; | 231 g_request_context = NULL; |
| 235 } | 232 } |
| 236 | 233 |
| 237 /* static */ | 234 /* static */ |
| 238 webkit_glue::WebSocketStreamHandleBridge* SimpleSocketStreamBridge::Create( | 235 webkit_glue::WebSocketStreamHandleBridge* SimpleSocketStreamBridge::Create( |
| 239 WebKit::WebSocketStreamHandle* handle, | 236 WebKit::WebSocketStreamHandle* handle, |
| 240 webkit_glue::WebSocketStreamHandleDelegate* delegate) { | 237 webkit_glue::WebSocketStreamHandleDelegate* delegate) { |
| 241 return new WebSocketStreamHandleBridgeImpl(handle, delegate); | 238 return new WebSocketStreamHandleBridgeImpl(handle, delegate); |
| 242 } | 239 } |
| OLD | NEW |