| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #ifndef SocketStreamHandleInternal_h | 31 #ifndef SocketStreamHandleInternal_h |
| 32 #define SocketStreamHandleInternal_h | 32 #define SocketStreamHandleInternal_h |
| 33 | 33 |
| 34 #include "platform/network/SocketStreamHandle.h" | 34 #include "platform/network/SocketStreamHandle.h" |
| 35 #include "public/platform/WebSocketStreamHandleClient.h" | 35 #include "public/platform/WebSocketStreamHandleClient.h" |
| 36 #include "public/platform/WebURL.h" | 36 #include "public/platform/WebURL.h" |
| 37 #include "wtf/PassOwnPtr.h" | 37 #include "wtf/PassOwnPtr.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 |
| 40 class WebData; | 41 class WebData; |
| 41 class WebSocketStreamError; | 42 class WebSocketStreamError; |
| 42 class WebSocketStreamHandle; | 43 class WebSocketStreamHandle; |
| 43 } | |
| 44 | 44 |
| 45 namespace blink { | 45 class PLATFORM_EXPORT SocketStreamHandleInternal : public GarbageCollectedFinali
zed<SocketStreamHandleInternal>, public WebSocketStreamHandleClient { |
| 46 | |
| 47 class PLATFORM_EXPORT SocketStreamHandleInternal : public GarbageCollectedFinali
zed<SocketStreamHandleInternal>, public blink::WebSocketStreamHandleClient { | |
| 48 WTF_MAKE_NONCOPYABLE(SocketStreamHandleInternal); | 46 WTF_MAKE_NONCOPYABLE(SocketStreamHandleInternal); |
| 49 public: | 47 public: |
| 50 static SocketStreamHandleInternal* create(SocketStreamHandle* handle) | 48 static SocketStreamHandleInternal* create(SocketStreamHandle* handle) |
| 51 { | 49 { |
| 52 return new SocketStreamHandleInternal(handle); | 50 return new SocketStreamHandleInternal(handle); |
| 53 } | 51 } |
| 54 virtual ~SocketStreamHandleInternal(); | 52 virtual ~SocketStreamHandleInternal(); |
| 55 | 53 |
| 56 void connect(const KURL&); | 54 void connect(const KURL&); |
| 57 int send(const char*, int); | 55 int send(const char*, int); |
| 58 void close(); | 56 void close(); |
| 59 | 57 |
| 60 virtual void didOpenStream(blink::WebSocketStreamHandle*, int); | 58 virtual void didOpenStream(WebSocketStreamHandle*, int); |
| 61 virtual void didSendData(blink::WebSocketStreamHandle*, int); | 59 virtual void didSendData(WebSocketStreamHandle*, int); |
| 62 virtual void didReceiveData(blink::WebSocketStreamHandle*, const blink::WebD
ata&); | 60 virtual void didReceiveData(WebSocketStreamHandle*, const WebData&); |
| 63 virtual void didClose(blink::WebSocketStreamHandle*); | 61 virtual void didClose(WebSocketStreamHandle*); |
| 64 virtual void didFail(blink::WebSocketStreamHandle*, const blink::WebSocketSt
reamError&); | 62 virtual void didFail(WebSocketStreamHandle*, const WebSocketStreamError&); |
| 65 | 63 |
| 66 static blink::WebSocketStreamHandle* toWebSocketStreamHandle(SocketStreamHan
dle* handle) | 64 static WebSocketStreamHandle* toWebSocketStreamHandle(SocketStreamHandle* ha
ndle) |
| 67 { | 65 { |
| 68 if (handle && handle->m_internal) | 66 if (handle && handle->m_internal) |
| 69 return handle->m_internal->m_socket.get(); | 67 return handle->m_internal->m_socket.get(); |
| 70 return 0; | 68 return 0; |
| 71 } | 69 } |
| 72 | 70 |
| 73 void trace(Visitor*); | 71 void trace(Visitor*); |
| 74 | 72 |
| 75 private: | 73 private: |
| 76 explicit SocketStreamHandleInternal(SocketStreamHandle*); | 74 explicit SocketStreamHandleInternal(SocketStreamHandle*); |
| 77 | 75 |
| 78 Member<SocketStreamHandle> m_handle; | 76 Member<SocketStreamHandle> m_handle; |
| 79 OwnPtr<blink::WebSocketStreamHandle> m_socket; | 77 OwnPtr<WebSocketStreamHandle> m_socket; |
| 80 int m_maxPendingSendAllowed; | 78 int m_maxPendingSendAllowed; |
| 81 int m_pendingAmountSent; | 79 int m_pendingAmountSent; |
| 82 }; | 80 }; |
| 83 | 81 |
| 84 } // namespace blink | 82 } // namespace blink |
| 85 | 83 |
| 86 #endif // SocketStreamHandleInternal_h | 84 #endif // SocketStreamHandleInternal_h |
| OLD | NEW |