| 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/socket/client_socket_pool_base.h" | 5 #include "net/socket/client_socket_pool_base.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/platform_thread.h" | 9 #include "base/platform_thread.h" |
| 10 #include "base/scoped_vector.h" | 10 #include "base/scoped_vector.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 virtual int Write( | 41 virtual int Write( |
| 42 IOBuffer* /* buf */, int /* len */, CompletionCallback* /* callback */) { | 42 IOBuffer* /* buf */, int /* len */, CompletionCallback* /* callback */) { |
| 43 return ERR_UNEXPECTED; | 43 return ERR_UNEXPECTED; |
| 44 } | 44 } |
| 45 virtual bool SetReceiveBufferSize(int32 size) { return true; }; | 45 virtual bool SetReceiveBufferSize(int32 size) { return true; }; |
| 46 virtual bool SetSendBufferSize(int32 size) { return true; }; | 46 virtual bool SetSendBufferSize(int32 size) { return true; }; |
| 47 | 47 |
| 48 // ClientSocket methods: | 48 // ClientSocket methods: |
| 49 | 49 |
| 50 virtual int Connect(CompletionCallback* callback) { | 50 virtual int Connect(CompletionCallback* callback, LoadLog* load_log) { |
| 51 connected_ = true; | 51 connected_ = true; |
| 52 return OK; | 52 return OK; |
| 53 } | 53 } |
| 54 | 54 |
| 55 virtual void Disconnect() { connected_ = false; } | 55 virtual void Disconnect() { connected_ = false; } |
| 56 virtual bool IsConnected() const { return connected_; } | 56 virtual bool IsConnected() const { return connected_; } |
| 57 virtual bool IsConnectedAndIdle() const { return connected_; } | 57 virtual bool IsConnectedAndIdle() const { return connected_; } |
| 58 | 58 |
| 59 #if defined(OS_LINUX) | 59 #if defined(OS_LINUX) |
| 60 virtual int GetPeerName(struct sockaddr* /* name */, | 60 virtual int GetPeerName(struct sockaddr* /* name */, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 return ERR_FAILED; | 190 return ERR_FAILED; |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 | 193 |
| 194 void set_load_state(LoadState load_state) { load_state_ = load_state; } | 194 void set_load_state(LoadState load_state) { load_state_ = load_state; } |
| 195 | 195 |
| 196 int DoConnect(bool succeed, bool was_async) { | 196 int DoConnect(bool succeed, bool was_async) { |
| 197 int result = ERR_CONNECTION_FAILED; | 197 int result = ERR_CONNECTION_FAILED; |
| 198 if (succeed) { | 198 if (succeed) { |
| 199 result = OK; | 199 result = OK; |
| 200 socket()->Connect(NULL); | 200 socket()->Connect(NULL, NULL); |
| 201 } else { | 201 } else { |
| 202 set_socket(NULL); | 202 set_socket(NULL); |
| 203 } | 203 } |
| 204 | 204 |
| 205 if (was_async) | 205 if (was_async) |
| 206 NotifyDelegateOfCompletion(result); | 206 NotifyDelegateOfCompletion(result); |
| 207 return result; | 207 return result; |
| 208 } | 208 } |
| 209 | 209 |
| 210 void AdvanceLoadState(LoadState state) { | 210 void AdvanceLoadState(LoadState state) { |
| (...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1868 | 1868 |
| 1869 pool_->CleanupTimedOutIdleSockets(); | 1869 pool_->CleanupTimedOutIdleSockets(); |
| 1870 rv = InitHandle(req.handle(), "a", 0, &req, pool_.get(), NULL); | 1870 rv = InitHandle(req.handle(), "a", 0, &req, pool_.get(), NULL); |
| 1871 EXPECT_EQ(OK, rv); | 1871 EXPECT_EQ(OK, rv); |
| 1872 EXPECT_TRUE(req.handle()->is_reused()); | 1872 EXPECT_TRUE(req.handle()->is_reused()); |
| 1873 } | 1873 } |
| 1874 | 1874 |
| 1875 } // namespace | 1875 } // namespace |
| 1876 | 1876 |
| 1877 } // namespace net | 1877 } // namespace net |
| OLD | NEW |