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

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

Issue 6382003: Reorder the methods in net/url_request/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compiling net_unittests != compiling the rest of chrome Created 9 years, 11 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.cc ('k') | net/url_request/url_request_throttler_entry.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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
(...skipping 14 matching lines...) Expand all
25 // made. 25 // made.
26 // 26 //
27 class URLRequestJobTracker { 27 class URLRequestJobTracker {
28 public: 28 public:
29 typedef std::vector<URLRequestJob*> JobList; 29 typedef std::vector<URLRequestJob*> JobList;
30 typedef JobList::const_iterator JobIterator; 30 typedef JobList::const_iterator JobIterator;
31 31
32 // The observer's methods are called on the thread that called AddObserver. 32 // The observer's methods are called on the thread that called AddObserver.
33 class JobObserver { 33 class JobObserver {
34 public: 34 public:
35 virtual ~JobObserver() {}
36
35 // Called after the given job has been added to the list 37 // Called after the given job has been added to the list
36 virtual void OnJobAdded(URLRequestJob* job) = 0; 38 virtual void OnJobAdded(URLRequestJob* job) = 0;
37 39
38 // Called after the given job has been removed from the list 40 // Called after the given job has been removed from the list
39 virtual void OnJobRemoved(URLRequestJob* job) = 0; 41 virtual void OnJobRemoved(URLRequestJob* job) = 0;
40 42
41 // Called when the given job has completed, before notifying the request 43 // Called when the given job has completed, before notifying the request
42 virtual void OnJobDone(URLRequestJob* job, 44 virtual void OnJobDone(URLRequestJob* job,
43 const net::URLRequestStatus& status) = 0; 45 const net::URLRequestStatus& status) = 0;
44 46
45 // Called when the given job is about to follow a redirect to the given 47 // Called when the given job is about to follow a redirect to the given
46 // new URL. The redirect type is given in status_code 48 // new URL. The redirect type is given in status_code
47 virtual void OnJobRedirect(URLRequestJob* job, const GURL& location, 49 virtual void OnJobRedirect(URLRequestJob* job, const GURL& location,
48 int status_code) = 0; 50 int status_code) = 0;
49 51
50 // Called when a new chunk of unfiltered bytes has been read for 52 // Called when a new chunk of unfiltered bytes has been read for
51 // the given job. |byte_count| is the number of bytes for that 53 // the given job. |byte_count| is the number of bytes for that
52 // read event only. |buf| is a pointer to the data buffer that 54 // read event only. |buf| is a pointer to the data buffer that
53 // contains those bytes. The data in |buf| is only valid for the 55 // contains those bytes. The data in |buf| is only valid for the
54 // duration of the OnBytesRead callback. 56 // duration of the OnBytesRead callback.
55 virtual void OnBytesRead(URLRequestJob* job, const char* buf, 57 virtual void OnBytesRead(URLRequestJob* job, const char* buf,
56 int byte_count) = 0; 58 int byte_count) = 0;
57
58 virtual ~JobObserver() {}
59 }; 59 };
60 60
61 URLRequestJobTracker(); 61 URLRequestJobTracker();
62 ~URLRequestJobTracker(); 62 ~URLRequestJobTracker();
63 63
64 // adds or removes an observer from the list. note, these methods should 64 // adds or removes an observer from the list. note, these methods should
65 // only be called on the same thread where URLRequest objects are used. 65 // only be called on the same thread where URLRequest objects are used.
66 void AddObserver(JobObserver* observer) { 66 void AddObserver(JobObserver* observer) {
67 observers_.AddObserver(observer); 67 observers_.AddObserver(observer);
68 } 68 }
(...skipping 26 matching lines...) Expand all
95 private: 95 private:
96 ObserverList<JobObserver> observers_; 96 ObserverList<JobObserver> observers_;
97 JobList active_jobs_; 97 JobList active_jobs_;
98 }; 98 };
99 99
100 extern URLRequestJobTracker g_url_request_job_tracker; 100 extern URLRequestJobTracker g_url_request_job_tracker;
101 101
102 } // namespace net 102 } // namespace net
103 103
104 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_TRACKER_H_ 104 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_TRACKER_H_
OLDNEW
« no previous file with comments | « net/url_request/url_request_job.cc ('k') | net/url_request/url_request_throttler_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698