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 CONTENT_COMMON_NET_URL_FETCHER_CORE_H_ | 5 #ifndef CONTENT_COMMON_NET_URL_FETCHER_CORE_H_ |
6 #define CONTENT_COMMON_NET_URL_FETCHER_CORE_H_ | 6 #define CONTENT_COMMON_NET_URL_FETCHER_CORE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 27 matching lines...) Expand all Loading... |
38 class URLRequestContextGetter; | 38 class URLRequestContextGetter; |
39 class URLRequestThrottlerEntryInterface; | 39 class URLRequestThrottlerEntryInterface; |
40 } // namespace net | 40 } // namespace net |
41 | 41 |
42 namespace content { | 42 namespace content { |
43 | 43 |
44 class URLFetcherCore | 44 class URLFetcherCore |
45 : public base::RefCountedThreadSafe<URLFetcherCore>, | 45 : public base::RefCountedThreadSafe<URLFetcherCore>, |
46 public net::URLRequest::Delegate { | 46 public net::URLRequest::Delegate { |
47 public: | 47 public: |
48 URLFetcherCore(URLFetcher* fetcher, | 48 URLFetcherCore(net::URLFetcher* fetcher, |
49 const GURL& original_url, | 49 const GURL& original_url, |
50 URLFetcher::RequestType request_type, | 50 net::URLFetcher::RequestType request_type, |
51 net::URLFetcherDelegate* d); | 51 net::URLFetcherDelegate* d); |
52 | 52 |
53 // Starts the load. It's important that this not happen in the constructor | 53 // Starts the load. It's important that this not happen in the constructor |
54 // because it causes the IO thread to begin AddRef()ing and Release()ing | 54 // because it causes the IO thread to begin AddRef()ing and Release()ing |
55 // us. If our caller hasn't had time to fully construct us and take a | 55 // us. If our caller hasn't had time to fully construct us and take a |
56 // reference, the IO thread could interrupt things, run a task, Release() | 56 // reference, the IO thread could interrupt things, run a task, Release() |
57 // us, and destroy us, leaving the caller with an already-destroyed object | 57 // us, and destroy us, leaving the caller with an already-destroyed object |
58 // when construction finishes. | 58 // when construction finishes. |
59 void Start(); | 59 void Start(); |
60 | 60 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 // Notify Delegate about the progress of upload/download. | 287 // Notify Delegate about the progress of upload/download. |
288 void InformDelegateUploadProgress(); | 288 void InformDelegateUploadProgress(); |
289 void InformDelegateUploadProgressInDelegateThread(int64 current, int64 total); | 289 void InformDelegateUploadProgressInDelegateThread(int64 current, int64 total); |
290 void InformDelegateDownloadProgress(); | 290 void InformDelegateDownloadProgress(); |
291 void InformDelegateDownloadProgressInDelegateThread(int64 current, | 291 void InformDelegateDownloadProgressInDelegateThread(int64 current, |
292 int64 total); | 292 int64 total); |
293 void InformDelegateDownloadDataIfNecessary(int bytes_read); | 293 void InformDelegateDownloadDataIfNecessary(int bytes_read); |
294 void InformDelegateDownloadDataInDelegateThread( | 294 void InformDelegateDownloadDataInDelegateThread( |
295 scoped_ptr<std::string> download_data); | 295 scoped_ptr<std::string> download_data); |
296 | 296 |
297 URLFetcher* fetcher_; // Corresponding fetcher object | 297 net::URLFetcher* fetcher_; // Corresponding fetcher object |
298 GURL original_url_; // The URL we were asked to fetch | 298 GURL original_url_; // The URL we were asked to fetch |
299 GURL url_; // The URL we eventually wound up at | 299 GURL url_; // The URL we eventually wound up at |
300 URLFetcher::RequestType request_type_; // What type of request is this? | 300 net::URLFetcher::RequestType request_type_; // What type of request is this? |
301 net::URLRequestStatus status_; // Status of the request | 301 net::URLRequestStatus status_; // Status of the request |
302 net::URLFetcherDelegate* delegate_; // Object to notify on completion | 302 net::URLFetcherDelegate* delegate_; // Object to notify on completion |
303 scoped_refptr<base::MessageLoopProxy> delegate_loop_proxy_; | 303 scoped_refptr<base::MessageLoopProxy> delegate_loop_proxy_; |
304 // Message loop proxy of the creating | 304 // Message loop proxy of the creating |
305 // thread. | 305 // thread. |
306 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 306 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
307 // The message loop proxy for the thread | 307 // The message loop proxy for the thread |
308 // on which the request IO happens. | 308 // on which the request IO happens. |
309 scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy_; | 309 scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy_; |
310 // The message loop proxy for the thread | 310 // The message loop proxy for the thread |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 base::debug::StackTrace stack_trace_; | 395 base::debug::StackTrace stack_trace_; |
396 | 396 |
397 static base::LazyInstance<Registry> g_registry; | 397 static base::LazyInstance<Registry> g_registry; |
398 | 398 |
399 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); | 399 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); |
400 }; | 400 }; |
401 | 401 |
402 } // namespace content | 402 } // namespace content |
403 | 403 |
404 #endif // CONTENT_COMMON_NET_URL_FETCHER_CORE_H_ | 404 #endif // CONTENT_COMMON_NET_URL_FETCHER_CORE_H_ |
OLD | NEW |