| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_SYNC_GLUE_HTTP_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_HTTP_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_HTTP_BRIDGE_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_HTTP_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 private: | 139 private: |
| 140 friend class ::HttpBridgeTest; | 140 friend class ::HttpBridgeTest; |
| 141 | 141 |
| 142 // Called on the IO loop to issue the network request. The extra level | 142 // Called on the IO loop to issue the network request. The extra level |
| 143 // of indirection is so that the unit test can override this behavior but we | 143 // of indirection is so that the unit test can override this behavior but we |
| 144 // still have a function to statically pass to PostTask. | 144 // still have a function to statically pass to PostTask. |
| 145 void CallMakeAsynchronousPost() { MakeAsynchronousPost(); } | 145 void CallMakeAsynchronousPost() { MakeAsynchronousPost(); } |
| 146 | 146 |
| 147 // Gets a customized URLRequestContext for bridged requests. See | 147 // Gets a customized URLRequestContext for bridged requests. See |
| 148 // RequestContext definition for details. | 148 // RequestContext definition for details. |
| 149 RequestContextGetter* context_getter_for_request_; | 149 scoped_refptr<RequestContextGetter> context_getter_for_request_; |
| 150 | 150 |
| 151 // Our hook into the network layer is a URLFetcher. USED ONLY ON THE IO LOOP, | 151 // Our hook into the network layer is a URLFetcher. USED ONLY ON THE IO LOOP, |
| 152 // so we can block created_on_loop_ while the fetch is in progress. | 152 // so we can block created_on_loop_ while the fetch is in progress. |
| 153 // NOTE: This is not a scoped_ptr for a reason. It must be deleted on the same | 153 // NOTE: This is not a scoped_ptr for a reason. It must be deleted on the same |
| 154 // thread that created it, which isn't the same thread |this| gets deleted on. | 154 // thread that created it, which isn't the same thread |this| gets deleted on. |
| 155 // We must manually delete url_poster_ on the IO loop. | 155 // We must manually delete url_poster_ on the IO loop. |
| 156 URLFetcher* url_poster_; | 156 URLFetcher* url_poster_; |
| 157 | 157 |
| 158 // The message loop of the thread we were created on. This is the thread that | 158 // The message loop of the thread we were created on. This is the thread that |
| 159 // will block on MakeSynchronousPost while the IO thread fetches data from | 159 // will block on MakeSynchronousPost while the IO thread fetches data from |
| (...skipping 29 matching lines...) Expand all Loading... |
| 189 : public sync_api::HttpPostProviderFactory { | 189 : public sync_api::HttpPostProviderFactory { |
| 190 public: | 190 public: |
| 191 explicit HttpBridgeFactory(URLRequestContextGetter* baseline_context_getter); | 191 explicit HttpBridgeFactory(URLRequestContextGetter* baseline_context_getter); |
| 192 virtual ~HttpBridgeFactory(); | 192 virtual ~HttpBridgeFactory(); |
| 193 virtual sync_api::HttpPostProviderInterface* Create(); | 193 virtual sync_api::HttpPostProviderInterface* Create(); |
| 194 virtual void Destroy(sync_api::HttpPostProviderInterface* http); | 194 virtual void Destroy(sync_api::HttpPostProviderInterface* http); |
| 195 private: | 195 private: |
| 196 // This request context is built on top of the baseline context and shares | 196 // This request context is built on top of the baseline context and shares |
| 197 // common components. | 197 // common components. |
| 198 HttpBridge::RequestContextGetter* GetRequestContextGetter(); | 198 HttpBridge::RequestContextGetter* GetRequestContextGetter(); |
| 199 // We must Release() this from the IO thread. | 199 scoped_refptr<HttpBridge::RequestContextGetter> request_context_getter_; |
| 200 HttpBridge::RequestContextGetter* request_context_getter_; | |
| 201 DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory); | 200 DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory); |
| 202 }; | 201 }; |
| 203 | 202 |
| 204 } // namespace browser_sync | 203 } // namespace browser_sync |
| 205 | 204 |
| 206 #endif // CHROME_BROWSER_SYNC_GLUE_HTTP_BRIDGE_H_ | 205 #endif // CHROME_BROWSER_SYNC_GLUE_HTTP_BRIDGE_H_ |
| OLD | NEW |