| OLD | NEW | 
|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 NET_SOCKET_STREAM_SOCKET_STREAM_JOB_MANAGER_H_ | 5 #ifndef NET_SOCKET_STREAM_SOCKET_STREAM_JOB_MANAGER_H_ | 
| 6 #define NET_SOCKET_STREAM_SOCKET_STREAM_JOB_MANAGER_H_ | 6 #define NET_SOCKET_STREAM_SOCKET_STREAM_JOB_MANAGER_H_ | 
| 7 #pragma once | 7 #pragma once | 
| 8 | 8 | 
| 9 #include <map> | 9 #include <map> | 
| 10 #include <string> | 10 #include <string> | 
| 11 | 11 | 
| 12 #include "net/socket_stream/socket_stream.h" | 12 #include "net/socket_stream/socket_stream.h" | 
| 13 #include "net/socket_stream/socket_stream_job.h" | 13 #include "net/socket_stream/socket_stream_job.h" | 
| 14 | 14 | 
|  | 15 template <typename T> struct DefaultSingletonTraits; | 
| 15 class GURL; | 16 class GURL; | 
| 16 | 17 | 
| 17 namespace net { | 18 namespace net { | 
| 18 | 19 | 
| 19 class SocketStreamJobManager { | 20 class SocketStreamJobManager { | 
| 20  public: | 21  public: | 
| 21   SocketStreamJobManager(); | 22   // Returns the singleton instance. | 
| 22   ~SocketStreamJobManager(); | 23   static SocketStreamJobManager* GetInstance(); | 
| 23 | 24 | 
| 24   SocketStreamJob* CreateJob( | 25   SocketStreamJob* CreateJob( | 
| 25       const GURL& url, SocketStream::Delegate* delegate) const; | 26       const GURL& url, SocketStream::Delegate* delegate) const; | 
| 26 | 27 | 
| 27   SocketStreamJob::ProtocolFactory* RegisterProtocolFactory( | 28   SocketStreamJob::ProtocolFactory* RegisterProtocolFactory( | 
| 28       const std::string& scheme, SocketStreamJob::ProtocolFactory* factory); | 29       const std::string& scheme, SocketStreamJob::ProtocolFactory* factory); | 
| 29 | 30 | 
| 30  private: | 31  private: | 
|  | 32   friend struct DefaultSingletonTraits<SocketStreamJobManager>; | 
| 31   typedef std::map<std::string, SocketStreamJob::ProtocolFactory*> FactoryMap; | 33   typedef std::map<std::string, SocketStreamJob::ProtocolFactory*> FactoryMap; | 
| 32 | 34 | 
|  | 35   SocketStreamJobManager(); | 
|  | 36   ~SocketStreamJobManager(); | 
|  | 37 | 
| 33   mutable Lock lock_; | 38   mutable Lock lock_; | 
| 34   FactoryMap factories_; | 39   FactoryMap factories_; | 
| 35 | 40 | 
| 36   DISALLOW_COPY_AND_ASSIGN(SocketStreamJobManager); | 41   DISALLOW_COPY_AND_ASSIGN(SocketStreamJobManager); | 
| 37 }; | 42 }; | 
| 38 | 43 | 
| 39 }  // namespace net | 44 }  // namespace net | 
| 40 | 45 | 
| 41 #endif  // NET_SOCKET_STREAM_SOCKET_STREAM_JOB_MANAGER_H_ | 46 #endif  // NET_SOCKET_STREAM_SOCKET_STREAM_JOB_MANAGER_H_ | 
| OLD | NEW | 
|---|