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 #ifndef CHROME_TEST_CHROMEDRIVER_NET_SYNC_WEBSOCKET_IMPL_H_ | 5 #ifndef CHROME_TEST_CHROMEDRIVER_NET_SYNC_WEBSOCKET_IMPL_H_ |
6 #define CHROME_TEST_CHROMEDRIVER_NET_SYNC_WEBSOCKET_IMPL_H_ | 6 #define CHROME_TEST_CHROMEDRIVER_NET_SYNC_WEBSOCKET_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 } | 28 } |
29 | 29 |
30 class GURL; | 30 class GURL; |
31 | 31 |
32 class SyncWebSocketImpl : public SyncWebSocket { | 32 class SyncWebSocketImpl : public SyncWebSocket { |
33 public: | 33 public: |
34 explicit SyncWebSocketImpl(net::URLRequestContextGetter* context_getter); | 34 explicit SyncWebSocketImpl(net::URLRequestContextGetter* context_getter); |
35 virtual ~SyncWebSocketImpl(); | 35 virtual ~SyncWebSocketImpl(); |
36 | 36 |
37 // Overridden from SyncWebSocket: | 37 // Overridden from SyncWebSocket: |
38 virtual bool IsConnected() OVERRIDE; | 38 virtual bool IsConnected() override; |
39 virtual bool Connect(const GURL& url) OVERRIDE; | 39 virtual bool Connect(const GURL& url) override; |
40 virtual bool Send(const std::string& message) OVERRIDE; | 40 virtual bool Send(const std::string& message) override; |
41 virtual StatusCode ReceiveNextMessage( | 41 virtual StatusCode ReceiveNextMessage( |
42 std::string* message, | 42 std::string* message, |
43 const base::TimeDelta& timeout) OVERRIDE; | 43 const base::TimeDelta& timeout) override; |
44 virtual bool HasNextMessage() OVERRIDE; | 44 virtual bool HasNextMessage() override; |
45 | 45 |
46 private: | 46 private: |
47 struct CoreTraits; | 47 struct CoreTraits; |
48 class Core : public WebSocketListener, | 48 class Core : public WebSocketListener, |
49 public base::RefCountedThreadSafe<Core, CoreTraits> { | 49 public base::RefCountedThreadSafe<Core, CoreTraits> { |
50 public: | 50 public: |
51 explicit Core(net::URLRequestContextGetter* context_getter); | 51 explicit Core(net::URLRequestContextGetter* context_getter); |
52 | 52 |
53 bool IsConnected(); | 53 bool IsConnected(); |
54 bool Connect(const GURL& url); | 54 bool Connect(const GURL& url); |
55 bool Send(const std::string& message); | 55 bool Send(const std::string& message); |
56 SyncWebSocket::StatusCode ReceiveNextMessage( | 56 SyncWebSocket::StatusCode ReceiveNextMessage( |
57 std::string* message, | 57 std::string* message, |
58 const base::TimeDelta& timeout); | 58 const base::TimeDelta& timeout); |
59 bool HasNextMessage(); | 59 bool HasNextMessage(); |
60 | 60 |
61 // Overriden from WebSocketListener: | 61 // Overriden from WebSocketListener: |
62 virtual void OnMessageReceived(const std::string& message) OVERRIDE; | 62 virtual void OnMessageReceived(const std::string& message) override; |
63 virtual void OnClose() OVERRIDE; | 63 virtual void OnClose() override; |
64 | 64 |
65 private: | 65 private: |
66 friend class base::RefCountedThreadSafe<Core, CoreTraits>; | 66 friend class base::RefCountedThreadSafe<Core, CoreTraits>; |
67 friend class base::DeleteHelper<Core>; | 67 friend class base::DeleteHelper<Core>; |
68 friend struct CoreTraits; | 68 friend struct CoreTraits; |
69 | 69 |
70 virtual ~Core(); | 70 virtual ~Core(); |
71 | 71 |
72 void ConnectOnIO(const GURL& url, | 72 void ConnectOnIO(const GURL& url, |
73 bool* success, | 73 bool* success, |
(...skipping 29 matching lines...) Expand all Loading... |
103 scoped_refptr<Core> core_; | 103 scoped_refptr<Core> core_; |
104 }; | 104 }; |
105 | 105 |
106 struct SyncWebSocketImpl::CoreTraits { | 106 struct SyncWebSocketImpl::CoreTraits { |
107 static void Destruct(const SyncWebSocketImpl::Core* core) { | 107 static void Destruct(const SyncWebSocketImpl::Core* core) { |
108 core->OnDestruct(); | 108 core->OnDestruct(); |
109 } | 109 } |
110 }; | 110 }; |
111 | 111 |
112 #endif // CHROME_TEST_CHROMEDRIVER_NET_SYNC_WEBSOCKET_IMPL_H_ | 112 #endif // CHROME_TEST_CHROMEDRIVER_NET_SYNC_WEBSOCKET_IMPL_H_ |
OLD | NEW |