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

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

Issue 5607004: net: Remove typedef net::URLRequestJob URLRequestJob; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 2 Created 10 years 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
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 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "net/url_request/url_request_job_tracker.h" 7 #include "net/url_request/url_request_job_tracker.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "net/url_request/url_request_job.h" 10 #include "net/url_request/url_request_job.h"
11 11
12 URLRequestJobTracker g_url_request_job_tracker; 12 URLRequestJobTracker g_url_request_job_tracker;
13 13
14 URLRequestJobTracker::URLRequestJobTracker() { 14 URLRequestJobTracker::URLRequestJobTracker() {
15 } 15 }
16 16
17 URLRequestJobTracker::~URLRequestJobTracker() { 17 URLRequestJobTracker::~URLRequestJobTracker() {
18 DLOG_IF(WARNING, active_jobs_.size() != 0) << 18 DLOG_IF(WARNING, active_jobs_.size() != 0) <<
19 "Leaking " << active_jobs_.size() << " URLRequestJob object(s), this could " 19 "Leaking " << active_jobs_.size() << " net::URLRequestJob object(s), this "
20 "be because the net::URLRequest forgot to free it (bad), or if the program " 20 "could be because the net::URLRequest forgot to free it (bad), or if the "
21 "was terminated while a request was active (normal)."; 21 "program was terminated while a request was active (normal).";
22 } 22 }
23 23
24 void URLRequestJobTracker::AddNewJob(URLRequestJob* job) { 24 void URLRequestJobTracker::AddNewJob(net::URLRequestJob* job) {
25 active_jobs_.push_back(job); 25 active_jobs_.push_back(job);
26 FOR_EACH_OBSERVER(JobObserver, observers_, OnJobAdded(job)); 26 FOR_EACH_OBSERVER(JobObserver, observers_, OnJobAdded(job));
27 } 27 }
28 28
29 void URLRequestJobTracker::RemoveJob(URLRequestJob* job) { 29 void URLRequestJobTracker::RemoveJob(net::URLRequestJob* job) {
30 JobList::iterator iter = std::find(active_jobs_.begin(), active_jobs_.end(), 30 JobList::iterator iter = std::find(active_jobs_.begin(), active_jobs_.end(),
31 job); 31 job);
32 if (iter == active_jobs_.end()) { 32 if (iter == active_jobs_.end()) {
33 NOTREACHED() << "Removing a non-active job"; 33 NOTREACHED() << "Removing a non-active job";
34 return; 34 return;
35 } 35 }
36 active_jobs_.erase(iter); 36 active_jobs_.erase(iter);
37 37
38 FOR_EACH_OBSERVER(JobObserver, observers_, OnJobRemoved(job)); 38 FOR_EACH_OBSERVER(JobObserver, observers_, OnJobRemoved(job));
39 } 39 }
40 40
41 void URLRequestJobTracker::OnJobDone(URLRequestJob* job, 41 void URLRequestJobTracker::OnJobDone(net::URLRequestJob* job,
42 const URLRequestStatus& status) { 42 const URLRequestStatus& status) {
43 FOR_EACH_OBSERVER(JobObserver, observers_, OnJobDone(job, status)); 43 FOR_EACH_OBSERVER(JobObserver, observers_, OnJobDone(job, status));
44 } 44 }
45 45
46 void URLRequestJobTracker::OnJobRedirect(URLRequestJob* job, 46 void URLRequestJobTracker::OnJobRedirect(net::URLRequestJob* job,
47 const GURL& location, 47 const GURL& location,
48 int status_code) { 48 int status_code) {
49 FOR_EACH_OBSERVER(JobObserver, observers_, 49 FOR_EACH_OBSERVER(JobObserver, observers_,
50 OnJobRedirect(job, location, status_code)); 50 OnJobRedirect(job, location, status_code));
51 } 51 }
52 52
53 void URLRequestJobTracker::OnBytesRead(URLRequestJob* job, 53 void URLRequestJobTracker::OnBytesRead(net::URLRequestJob* job,
54 const char* buf, 54 const char* buf,
55 int byte_count) { 55 int byte_count) {
56 FOR_EACH_OBSERVER(JobObserver, observers_, 56 FOR_EACH_OBSERVER(JobObserver, observers_,
57 OnBytesRead(job, buf, byte_count)); 57 OnBytesRead(job, buf, byte_count));
58 } 58 }
OLDNEW
« no previous file with comments | « net/url_request/url_request_job_metrics.h ('k') | net/url_request/url_request_job_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698