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 SYNC_INTERNAL_API_PUBLIC_HTTP_POST_PROVIDER_FACTORY_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_HTTP_POST_PROVIDER_FACTORY_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_HTTP_POST_PROVIDER_FACTORY_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_HTTP_POST_PROVIDER_FACTORY_H_ |
7 #pragma once | |
8 | 7 |
9 namespace syncer { | 8 namespace syncer { |
10 | 9 |
11 class HttpPostProviderInterface; | 10 class HttpPostProviderInterface; |
12 | 11 |
13 // A factory to create HttpPostProviders to hide details about the | 12 // A factory to create HttpPostProviders to hide details about the |
14 // implementations and dependencies. | 13 // implementations and dependencies. |
15 // A factory instance itself should be owned by whomever uses it to create | 14 // A factory instance itself should be owned by whomever uses it to create |
16 // HttpPostProviders. | 15 // HttpPostProviders. |
17 class HttpPostProviderFactory { | 16 class HttpPostProviderFactory { |
18 public: | 17 public: |
19 virtual ~HttpPostProviderFactory() {} | 18 virtual ~HttpPostProviderFactory() {} |
20 | 19 |
21 // Obtain a new HttpPostProviderInterface instance, owned by caller. | 20 // Obtain a new HttpPostProviderInterface instance, owned by caller. |
22 virtual HttpPostProviderInterface* Create() = 0; | 21 virtual HttpPostProviderInterface* Create() = 0; |
23 | 22 |
24 // When the interface is no longer needed (ready to be cleaned up), clients | 23 // When the interface is no longer needed (ready to be cleaned up), clients |
25 // must call Destroy(). | 24 // must call Destroy(). |
26 // This allows actual HttpPostProvider subclass implementations to be | 25 // This allows actual HttpPostProvider subclass implementations to be |
27 // reference counted, which is useful if a particular implementation uses | 26 // reference counted, which is useful if a particular implementation uses |
28 // multiple threads to serve network requests. | 27 // multiple threads to serve network requests. |
29 virtual void Destroy(HttpPostProviderInterface* http) = 0; | 28 virtual void Destroy(HttpPostProviderInterface* http) = 0; |
30 }; | 29 }; |
31 | 30 |
32 } // namespace syncer | 31 } // namespace syncer |
33 | 32 |
34 #endif // SYNC_INTERNAL_API_PUBLIC_HTTP_POST_PROVIDER_FACTORY_H_ | 33 #endif // SYNC_INTERNAL_API_PUBLIC_HTTP_POST_PROVIDER_FACTORY_H_ |
OLD | NEW |