| 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 // CancelableRequestProviders and Consumers work together to make requests that | 5 // CancelableRequestProviders and Consumers work together to make requests that |
| 6 // execute on a background thread in the provider and return data to the | 6 // execute on a background thread in the provider and return data to the |
| 7 // consumer. These class collaborate to keep a list of open requests and to | 7 // consumer. These class collaborate to keep a list of open requests and to |
| 8 // make sure that requests to not outlive either of the objects involved in the | 8 // make sure that requests to not outlive either of the objects involved in the |
| 9 // transaction. | 9 // transaction. |
| 10 // | 10 // |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 DCHECK(pending_requests_.find(PendingRequest(provider, handle)) == | 290 DCHECK(pending_requests_.find(PendingRequest(provider, handle)) == |
| 291 pending_requests_.end()); | 291 pending_requests_.end()); |
| 292 pending_requests_[PendingRequest(provider, handle)] = get_initial_t(); | 292 pending_requests_[PendingRequest(provider, handle)] = get_initial_t(); |
| 293 } | 293 } |
| 294 | 294 |
| 295 virtual void OnRequestRemoved(CancelableRequestProvider* provider, | 295 virtual void OnRequestRemoved(CancelableRequestProvider* provider, |
| 296 CancelableRequestProvider::Handle handle) { | 296 CancelableRequestProvider::Handle handle) { |
| 297 typename PendingRequestList::iterator i = | 297 typename PendingRequestList::iterator i = |
| 298 pending_requests_.find(PendingRequest(provider, handle)); | 298 pending_requests_.find(PendingRequest(provider, handle)); |
| 299 if (i == pending_requests_.end()) { | 299 if (i == pending_requests_.end()) { |
| 300 NOTREACHED() << "Got a complete notification for a nonexistant request"; | 300 NOTREACHED() << "Got a complete notification for a nonexistent request"; |
| 301 return; | 301 return; |
| 302 } | 302 } |
| 303 | 303 |
| 304 pending_requests_.erase(i); | 304 pending_requests_.erase(i); |
| 305 } | 305 } |
| 306 | 306 |
| 307 // Lists all outstanding requests. | 307 // Lists all outstanding requests. |
| 308 PendingRequestList pending_requests_; | 308 PendingRequestList pending_requests_; |
| 309 }; | 309 }; |
| 310 | 310 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 } | 559 } |
| 560 | 560 |
| 561 // The value. | 561 // The value. |
| 562 Type value; | 562 Type value; |
| 563 | 563 |
| 564 protected: | 564 protected: |
| 565 virtual ~CancelableRequest1() {} | 565 virtual ~CancelableRequest1() {} |
| 566 }; | 566 }; |
| 567 | 567 |
| 568 #endif // CHROME_BROWSER_CANCELABLE_REQUEST_H__ | 568 #endif // CHROME_BROWSER_CANCELABLE_REQUEST_H__ |
| OLD | NEW |