OLD | NEW |
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 "net/url_request/url_request_job_tracker.h" | 5 #include "net/url_request/url_request_job_tracker.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
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 namespace net { | 12 namespace net { |
13 | 13 |
14 URLRequestJobTracker g_url_request_job_tracker; | 14 URLRequestJobTracker g_url_request_job_tracker; |
15 | 15 |
16 URLRequestJobTracker::URLRequestJobTracker() { | 16 URLRequestJobTracker::URLRequestJobTracker() { |
17 } | 17 } |
18 | 18 |
19 URLRequestJobTracker::~URLRequestJobTracker() { | 19 URLRequestJobTracker::~URLRequestJobTracker() { |
20 DLOG_IF(WARNING, active_jobs_.size() != 0) << | 20 DLOG_IF(WARNING, !active_jobs_.empty()) << |
21 "Leaking " << active_jobs_.size() << " URLRequestJob object(s), this " | 21 "Leaking " << active_jobs_.size() << " URLRequestJob object(s), this " |
22 "could be because the URLRequest forgot to free it (bad), or if the " | 22 "could be because the URLRequest forgot to free it (bad), or if the " |
23 "program was terminated while a request was active (normal)."; | 23 "program was terminated while a request was active (normal)."; |
24 } | 24 } |
25 | 25 |
26 void URLRequestJobTracker::AddNewJob(URLRequestJob* job) { | 26 void URLRequestJobTracker::AddNewJob(URLRequestJob* job) { |
27 active_jobs_.push_back(job); | 27 active_jobs_.push_back(job); |
28 FOR_EACH_OBSERVER(JobObserver, observers_, OnJobAdded(job)); | 28 FOR_EACH_OBSERVER(JobObserver, observers_, OnJobAdded(job)); |
29 } | 29 } |
30 | 30 |
(...skipping 22 matching lines...) Expand all Loading... |
53 } | 53 } |
54 | 54 |
55 void URLRequestJobTracker::OnBytesRead(URLRequestJob* job, | 55 void URLRequestJobTracker::OnBytesRead(URLRequestJob* job, |
56 const char* buf, | 56 const char* buf, |
57 int byte_count) { | 57 int byte_count) { |
58 FOR_EACH_OBSERVER(JobObserver, observers_, | 58 FOR_EACH_OBSERVER(JobObserver, observers_, |
59 OnBytesRead(job, buf, byte_count)); | 59 OnBytesRead(job, buf, byte_count)); |
60 } | 60 } |
61 | 61 |
62 } // namespace net | 62 } // namespace net |
OLD | NEW |