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 #include "net/http/http_stream_factory_impl.h" | 5 #include "net/http/http_stream_factory_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 template<typename ParentPool> | 313 template<typename ParentPool> |
314 class CapturePreconnectsSocketPool : public ParentPool { | 314 class CapturePreconnectsSocketPool : public ParentPool { |
315 public: | 315 public: |
316 CapturePreconnectsSocketPool(HostResolver* host_resolver, | 316 CapturePreconnectsSocketPool(HostResolver* host_resolver, |
317 CertVerifier* cert_verifier); | 317 CertVerifier* cert_verifier); |
318 | 318 |
319 int last_num_streams() const { | 319 int last_num_streams() const { |
320 return last_num_streams_; | 320 return last_num_streams_; |
321 } | 321 } |
322 | 322 |
323 virtual int RequestSocket(const std::string& group_name, | 323 int RequestSocket(const std::string& group_name, |
324 const void* socket_params, | 324 const void* socket_params, |
325 RequestPriority priority, | 325 RequestPriority priority, |
326 ClientSocketHandle* handle, | 326 ClientSocketHandle* handle, |
327 const CompletionCallback& callback, | 327 const CompletionCallback& callback, |
328 const BoundNetLog& net_log) override { | 328 const BoundNetLog& net_log) override { |
329 ADD_FAILURE(); | 329 ADD_FAILURE(); |
330 return ERR_UNEXPECTED; | 330 return ERR_UNEXPECTED; |
331 } | 331 } |
332 | 332 |
333 virtual void RequestSockets(const std::string& group_name, | 333 void RequestSockets(const std::string& group_name, |
334 const void* socket_params, | 334 const void* socket_params, |
335 int num_sockets, | 335 int num_sockets, |
336 const BoundNetLog& net_log) override { | 336 const BoundNetLog& net_log) override { |
337 last_num_streams_ = num_sockets; | 337 last_num_streams_ = num_sockets; |
338 } | 338 } |
339 | 339 |
340 virtual void CancelRequest(const std::string& group_name, | 340 void CancelRequest(const std::string& group_name, |
341 ClientSocketHandle* handle) override { | 341 ClientSocketHandle* handle) override { |
342 ADD_FAILURE(); | 342 ADD_FAILURE(); |
343 } | 343 } |
344 virtual void ReleaseSocket(const std::string& group_name, | 344 void ReleaseSocket(const std::string& group_name, |
345 scoped_ptr<StreamSocket> socket, | 345 scoped_ptr<StreamSocket> socket, |
346 int id) override { | 346 int id) override { |
347 ADD_FAILURE(); | 347 ADD_FAILURE(); |
348 } | 348 } |
349 virtual void CloseIdleSockets() override { | 349 void CloseIdleSockets() override { ADD_FAILURE(); } |
350 ADD_FAILURE(); | 350 int IdleSocketCount() const override { |
351 } | |
352 virtual int IdleSocketCount() const override { | |
353 ADD_FAILURE(); | 351 ADD_FAILURE(); |
354 return 0; | 352 return 0; |
355 } | 353 } |
356 virtual int IdleSocketCountInGroup( | 354 int IdleSocketCountInGroup(const std::string& group_name) const override { |
357 const std::string& group_name) const override { | |
358 ADD_FAILURE(); | 355 ADD_FAILURE(); |
359 return 0; | 356 return 0; |
360 } | 357 } |
361 virtual LoadState GetLoadState( | 358 LoadState GetLoadState(const std::string& group_name, |
362 const std::string& group_name, | 359 const ClientSocketHandle* handle) const override { |
363 const ClientSocketHandle* handle) const override { | |
364 ADD_FAILURE(); | 360 ADD_FAILURE(); |
365 return LOAD_STATE_IDLE; | 361 return LOAD_STATE_IDLE; |
366 } | 362 } |
367 virtual base::TimeDelta ConnectionTimeout() const override { | 363 base::TimeDelta ConnectionTimeout() const override { |
368 return base::TimeDelta(); | 364 return base::TimeDelta(); |
369 } | 365 } |
370 | 366 |
371 private: | 367 private: |
372 int last_num_streams_; | 368 int last_num_streams_; |
373 }; | 369 }; |
374 | 370 |
375 typedef CapturePreconnectsSocketPool<TransportClientSocketPool> | 371 typedef CapturePreconnectsSocketPool<TransportClientSocketPool> |
376 CapturePreconnectsTransportSocketPool; | 372 CapturePreconnectsTransportSocketPool; |
377 typedef CapturePreconnectsSocketPool<HttpProxyClientSocketPool> | 373 typedef CapturePreconnectsSocketPool<HttpProxyClientSocketPool> |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); | 1357 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); |
1362 | 1358 |
1363 // Make sure there is no orphaned job. it is already canceled. | 1359 // Make sure there is no orphaned job. it is already canceled. |
1364 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( | 1360 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( |
1365 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); | 1361 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); |
1366 } | 1362 } |
1367 | 1363 |
1368 } // namespace | 1364 } // namespace |
1369 | 1365 |
1370 } // namespace net | 1366 } // namespace net |
OLD | NEW |