| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "net/websockets/websocket_throttle.h" | 5 #include "net/websockets/websocket_throttle.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <ws2tcpip.h> | 8 #include <ws2tcpip.h> |
| 9 #else | 9 #else |
| 10 #include <netdb.h> | 10 #include <netdb.h> |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 static const char* kKeyName; | 124 static const char* kKeyName; |
| 125 | 125 |
| 126 private: | 126 private: |
| 127 class CompletionCallbackRunner | 127 class CompletionCallbackRunner |
| 128 : public base::RefCountedThreadSafe<CompletionCallbackRunner> { | 128 : public base::RefCountedThreadSafe<CompletionCallbackRunner> { |
| 129 public: | 129 public: |
| 130 explicit CompletionCallbackRunner(CompletionCallback* callback) | 130 explicit CompletionCallbackRunner(CompletionCallback* callback) |
| 131 : callback_(callback) { | 131 : callback_(callback) { |
| 132 DCHECK(callback_); | 132 DCHECK(callback_); |
| 133 } | 133 } |
| 134 virtual ~CompletionCallbackRunner() {} | |
| 135 void Run() { | 134 void Run() { |
| 136 callback_->Run(OK); | 135 callback_->Run(OK); |
| 137 } | 136 } |
| 138 private: | 137 private: |
| 138 friend class base::RefCountedThreadSafe<CompletionCallbackRunner>; |
| 139 |
| 140 virtual ~CompletionCallbackRunner() {} |
| 141 |
| 139 CompletionCallback* callback_; | 142 CompletionCallback* callback_; |
| 140 | 143 |
| 141 DISALLOW_COPY_AND_ASSIGN(CompletionCallbackRunner); | 144 DISALLOW_COPY_AND_ASSIGN(CompletionCallbackRunner); |
| 142 }; | 145 }; |
| 143 | 146 |
| 144 const AddressList& address_list_; | 147 const AddressList& address_list_; |
| 145 | 148 |
| 146 CompletionCallback* callback_; | 149 CompletionCallback* callback_; |
| 147 // True if waiting another websocket connection is established. | 150 // True if waiting another websocket connection is established. |
| 148 // False if the websocket is performing handshaking. | 151 // False if the websocket is performing handshaking. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 state->Wakeup(); | 289 state->Wakeup(); |
| 287 } | 290 } |
| 288 } | 291 } |
| 289 | 292 |
| 290 /* static */ | 293 /* static */ |
| 291 void WebSocketThrottle::Init() { | 294 void WebSocketThrottle::Init() { |
| 292 Singleton<WebSocketThrottle>::get(); | 295 Singleton<WebSocketThrottle>::get(); |
| 293 } | 296 } |
| 294 | 297 |
| 295 } // namespace net | 298 } // namespace net |
| OLD | NEW |