Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: net/url_request/url_request_job_tracker.h

Issue 7033036: net: Add NET_API to url_request. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/url_request/url_request_job_factory.h ('k') | net/url_request/url_request_test_job.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_JOB_TRACKER_H_ 5 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_TRACKER_H_
6 #define NET_URL_REQUEST_URL_REQUEST_JOB_TRACKER_H_ 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_TRACKER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "net/base/net_api.h"
12 #include "net/url_request/url_request_status.h" 13 #include "net/url_request/url_request_status.h"
13 14
14 class GURL; 15 class GURL;
15 16
16 namespace net { 17 namespace net {
17 class URLRequestJob; 18 class URLRequestJob;
18 19
19 // This class maintains a list of active URLRequestJobs for debugging purposes. 20 // This class maintains a list of active URLRequestJobs for debugging purposes.
20 // This allows us to warn on leaked jobs and also allows an observer to track 21 // This allows us to warn on leaked jobs and also allows an observer to track
21 // what is happening, for example, for the network status monitor. 22 // what is happening, for example, for the network status monitor.
22 // 23 //
23 // NOTE: URLRequest is single-threaded, so this class should only be used 24 // NOTE: URLRequest is single-threaded, so this class should only be used
24 // onthe same thread where all of the application's URLRequest calls are 25 // onthe same thread where all of the application's URLRequest calls are
25 // made. 26 // made.
26 // 27 //
27 class URLRequestJobTracker { 28 class NET_API URLRequestJobTracker {
28 public: 29 public:
29 typedef std::vector<URLRequestJob*> JobList; 30 typedef std::vector<URLRequestJob*> JobList;
30 typedef JobList::const_iterator JobIterator; 31 typedef JobList::const_iterator JobIterator;
31 32
32 // The observer's methods are called on the thread that called AddObserver. 33 // The observer's methods are called on the thread that called AddObserver.
33 class JobObserver { 34 class JobObserver {
34 public: 35 public:
35 virtual ~JobObserver() {} 36 virtual ~JobObserver() {}
36 37
37 // Called after the given job has been added to the list 38 // Called after the given job has been added to the list
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 91 }
91 JobIterator end() const { 92 JobIterator end() const {
92 return active_jobs_.end(); 93 return active_jobs_.end();
93 } 94 }
94 95
95 private: 96 private:
96 ObserverList<JobObserver> observers_; 97 ObserverList<JobObserver> observers_;
97 JobList active_jobs_; 98 JobList active_jobs_;
98 }; 99 };
99 100
100 extern URLRequestJobTracker g_url_request_job_tracker; 101 NET_API extern URLRequestJobTracker g_url_request_job_tracker;
101 102
102 } // namespace net 103 } // namespace net
103 104
104 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_TRACKER_H_ 105 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_TRACKER_H_
OLDNEW
« no previous file with comments | « net/url_request/url_request_job_factory.h ('k') | net/url_request/url_request_test_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698