| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_BRIDGE_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_ |
| 6 #define SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 17 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
| 18 #include "base/threading/thread_checker.h" |
| 18 #include "base/timer/timer.h" | 19 #include "base/timer/timer.h" |
| 19 #include "net/url_request/url_fetcher_delegate.h" | 20 #include "net/url_request/url_fetcher_delegate.h" |
| 20 #include "net/url_request/url_request_context.h" | 21 #include "net/url_request/url_request_context.h" |
| 21 #include "net/url_request/url_request_context_getter.h" | 22 #include "net/url_request/url_request_context_getter.h" |
| 22 #include "sync/base/sync_export.h" | 23 #include "sync/base/sync_export.h" |
| 23 #include "sync/internal_api/public/base/cancelation_observer.h" | 24 #include "sync/internal_api/public/base/cancelation_observer.h" |
| 24 #include "sync/internal_api/public/http_post_provider_factory.h" | 25 #include "sync/internal_api/public/http_post_provider_factory.h" |
| 25 #include "sync/internal_api/public/http_post_provider_interface.h" | 26 #include "sync/internal_api/public/http_post_provider_interface.h" |
| 26 #include "sync/internal_api/public/network_time_update_callback.h" | 27 #include "sync/internal_api/public/network_time_update_callback.h" |
| 27 #include "url/gurl.h" | 28 #include "url/gurl.h" |
| 28 | 29 |
| 29 class HttpBridgeTest; | 30 class HttpBridgeTest; |
| 30 | 31 |
| 31 namespace base { | |
| 32 class MessageLoop; | |
| 33 } | |
| 34 | |
| 35 namespace net { | 32 namespace net { |
| 36 class HttpResponseHeaders; | 33 class HttpResponseHeaders; |
| 37 class HttpUserAgentSettings; | 34 class HttpUserAgentSettings; |
| 38 class URLFetcher; | 35 class URLFetcher; |
| 39 class URLRequestJobFactory; | 36 class URLRequestJobFactory; |
| 40 } | 37 } |
| 41 | 38 |
| 42 namespace syncer { | 39 namespace syncer { |
| 43 | 40 |
| 44 class CancelationSignal; | 41 class CancelationSignal; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // callbacks coming from the IO thread en route to finally destroying the | 105 // callbacks coming from the IO thread en route to finally destroying the |
| 109 // fetcher. | 106 // fetcher. |
| 110 void DestroyURLFetcherOnIOThread(net::URLFetcher* fetcher, | 107 void DestroyURLFetcherOnIOThread(net::URLFetcher* fetcher, |
| 111 base::Timer* fetch_timer); | 108 base::Timer* fetch_timer); |
| 112 | 109 |
| 113 void UpdateNetworkTime(); | 110 void UpdateNetworkTime(); |
| 114 | 111 |
| 115 // Helper method to abort the request if we timed out. | 112 // Helper method to abort the request if we timed out. |
| 116 void OnURLFetchTimedOut(); | 113 void OnURLFetchTimedOut(); |
| 117 | 114 |
| 118 // The message loop of the thread we were created on. This is the thread that | 115 // Used to check whether a method runs on the thread that we were created on. |
| 119 // will block on MakeSynchronousPost while the IO thread fetches data from | 116 // This is the thread that will block on MakeSynchronousPost while the IO |
| 120 // the network. | 117 // thread fetches data from the network. |
| 121 // This should be the main syncer thread (SyncerThread) which is what blocks | 118 // This should be the main syncer thread (SyncerThread) which is what blocks |
| 122 // on network IO through curl_easy_perform. | 119 // on network IO through curl_easy_perform. |
| 123 base::MessageLoop* const created_on_loop_; | 120 base::ThreadChecker thread_checker_; |
| 124 | 121 |
| 125 // The user agent for all requests. | 122 // The user agent for all requests. |
| 126 const std::string user_agent_; | 123 const std::string user_agent_; |
| 127 | 124 |
| 128 // The URL to POST to. | 125 // The URL to POST to. |
| 129 GURL url_for_request_; | 126 GURL url_for_request_; |
| 130 | 127 |
| 131 // POST payload information. | 128 // POST payload information. |
| 132 std::string content_type_; | 129 std::string content_type_; |
| 133 std::string request_content_; | 130 std::string request_content_; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 // A callback to tag Sync request to be able to record data use of this | 224 // A callback to tag Sync request to be able to record data use of this |
| 228 // service by data_use_measurement component. | 225 // service by data_use_measurement component. |
| 229 BindToTrackerCallback bind_to_tracker_callback_; | 226 BindToTrackerCallback bind_to_tracker_callback_; |
| 230 | 227 |
| 231 DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory); | 228 DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory); |
| 232 }; | 229 }; |
| 233 | 230 |
| 234 } // namespace syncer | 231 } // namespace syncer |
| 235 | 232 |
| 236 #endif // SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_ | 233 #endif // SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_ |
| OLD | NEW |