| 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 NET_URL_REQUEST_URL_REQUEST_INET_JOB_H__ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_INET_JOB_H__ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_INET_JOB_H__ | 6 #define NET_URL_REQUEST_URL_REQUEST_INET_JOB_H__ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <wininet.h> | 9 #include <wininet.h> |
| 10 | 10 |
| 11 #include "base/lock.h" |
| 11 #include "net/url_request/url_request.h" | 12 #include "net/url_request/url_request.h" |
| 12 #include "net/url_request/url_request_job.h" | 13 #include "net/url_request/url_request_job.h" |
| 13 | 14 |
| 14 namespace net { | 15 namespace net { |
| 15 class AuthData; | 16 class AuthData; |
| 16 } | 17 } |
| 17 | 18 |
| 18 class MessageLoop; | 19 class MessageLoop; |
| 19 | 20 |
| 20 // For all WinInet-based URL requests | 21 // For all WinInet-based URL requests |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 119 |
| 119 // Authentication information. | 120 // Authentication information. |
| 120 scoped_refptr<net::AuthData> proxy_auth_; | 121 scoped_refptr<net::AuthData> proxy_auth_; |
| 121 scoped_refptr<net::AuthData> server_auth_; | 122 scoped_refptr<net::AuthData> server_auth_; |
| 122 | 123 |
| 123 private: | 124 private: |
| 124 | 125 |
| 125 // One-time global state setup | 126 // One-time global state setup |
| 126 static void InitializeTheInternet(const std::string& user_agent); | 127 static void InitializeTheInternet(const std::string& user_agent); |
| 127 | 128 |
| 128 // Runs on the thread where the first URLRequest was created | |
| 129 static LRESULT CALLBACK URLRequestWndProc(HWND hwnd, UINT message, | |
| 130 WPARAM wparam, LPARAM lparam); | |
| 131 | |
| 132 // Runs on some background thread (called by WinInet) | 129 // Runs on some background thread (called by WinInet) |
| 133 static void CALLBACK URLRequestStatusCallback(HINTERNET handle, | 130 static void CALLBACK URLRequestStatusCallback(HINTERNET handle, |
| 134 DWORD_PTR job_id, | 131 DWORD_PTR job_id, |
| 135 DWORD status, | 132 DWORD status, |
| 136 LPVOID status_info, | 133 LPVOID status_info, |
| 137 DWORD status_info_len); | 134 DWORD status_info_len); |
| 138 | 135 |
| 139 static HINTERNET the_internet_; | 136 static HINTERNET the_internet_; |
| 140 static HWND message_hwnd_; | |
| 141 #ifndef NDEBUG | 137 #ifndef NDEBUG |
| 142 static MessageLoop* my_message_loop_; // Used to sanity-check that all | 138 static MessageLoop* my_message_loop_; // Used to sanity-check that all |
| 143 // requests are made on the same | 139 // requests are made on the same |
| 144 // thread | 140 // thread |
| 145 #endif | 141 #endif |
| 146 | 142 |
| 147 // true if waiting for OnIOComplete to be called | 143 // true if waiting for OnIOComplete to be called |
| 148 bool is_waiting_; | 144 bool is_waiting_; |
| 149 | 145 |
| 150 // debugging state - is there a read already in progress | 146 // debugging state - is there a read already in progress |
| 151 bool read_in_progress_; | 147 bool read_in_progress_; |
| 152 | 148 |
| 153 // The result and error code of asynchronous IO. It is modified by the | 149 // The result and error code of asynchronous IO. It is modified by the |
| 154 // status callback functions on asynchronous IO completion and passed to | 150 // status callback functions on asynchronous IO completion and passed to |
| 155 // CallOnIOComplete. Since there is at most one pending IO, the object | 151 // CallOnIOComplete. Since there is at most one pending IO, the object |
| 156 // can reuse the async_result_ member for all its asynchronous IOs. | 152 // can reuse the async_result_ member for all its asynchronous IOs. |
| 157 AsyncResult async_result_; | 153 AsyncResult async_result_; |
| 158 | 154 |
| 155 Lock loop_lock_; |
| 156 MessageLoop* loop_; |
| 157 |
| 159 DISALLOW_EVIL_CONSTRUCTORS(URLRequestInetJob); | 158 DISALLOW_EVIL_CONSTRUCTORS(URLRequestInetJob); |
| 160 }; | 159 }; |
| 161 | 160 |
| 162 #endif // NET_URL_REQUEST_URL_REQUEST_INET_JOB_H__ | 161 #endif // NET_URL_REQUEST_URL_REQUEST_INET_JOB_H__ |
| 163 | 162 |
| OLD | NEW |