Chromium Code Reviews| Index: content/common/socket_stream_handle_data.cc |
| diff --git a/content/common/socket_stream_handle_data.cc b/content/common/socket_stream_handle_data.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..03b7c3e4bbf605e1f4f829a12b439a826e309db1 |
| --- /dev/null |
| +++ b/content/common/socket_stream_handle_data.cc |
| @@ -0,0 +1,31 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/common/socket_stream_handle_data.h" |
| + |
| +#include "webkit/glue/websocketstreamhandle_impl.h" |
| + |
| +using webkit_glue::WebSocketStreamHandleImpl; |
| +using WebKit::WebSocketStreamHandle; |
| + |
| +// static |
| +void SocketStreamHandleData::AddToHandle( |
| + WebSocketStreamHandle* handle, int render_view_id) { |
| + DCHECK(handle); |
|
darin (slow to review)
2012/03/20 20:01:00
nit: more conventional to use NOTREACHED here so y
Takashi Toyoshima
2012/03/21 00:57:17
Done.
|
| + if (!handle) |
| + return; |
| + WebSocketStreamHandleImpl* impl = |
| + static_cast<WebSocketStreamHandleImpl*>(handle); |
| + impl->SetUserData(handle, new SocketStreamHandleData(render_view_id)); |
| +} |
| + |
| +// static |
| +const SocketStreamHandleData* SocketStreamHandleData::ForHandle( |
| + WebSocketStreamHandle* handle) { |
| + if (!handle) |
| + return NULL; |
| + WebSocketStreamHandleImpl* impl = |
| + static_cast<WebSocketStreamHandleImpl*>(handle); |
| + return static_cast<SocketStreamHandleData*>(impl->GetUserData(handle)); |
| +} |