OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/content_hash_fetcher.h" | 5 #include "extensions/browser/content_hash_fetcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 base::TaskPriority::USER_VISIBLE), | 201 base::TaskPriority::USER_VISIBLE), |
202 base::Bind(&ContentHashFetcherJob::LoadVerifiedContents, this, | 202 base::Bind(&ContentHashFetcherJob::LoadVerifiedContents, this, |
203 verified_contents_path), | 203 verified_contents_path), |
204 base::Bind(&ContentHashFetcherJob::DoneCheckingForVerifiedContents, | 204 base::Bind(&ContentHashFetcherJob::DoneCheckingForVerifiedContents, |
205 this)); | 205 this)); |
206 } | 206 } |
207 | 207 |
208 void ContentHashFetcherJob::Cancel() { | 208 void ContentHashFetcherJob::Cancel() { |
209 base::AutoLock autolock(cancelled_lock_); | 209 base::AutoLock autolock(cancelled_lock_); |
210 cancelled_ = true; | 210 cancelled_ = true; |
211 url_fetcher_.reset(); | |
Devlin
2017/04/13 15:12:18
nit: We can get rid of cancelled_ now and use !url
| |
211 } | 212 } |
212 | 213 |
213 bool ContentHashFetcherJob::IsCancelled() { | 214 bool ContentHashFetcherJob::IsCancelled() { |
214 base::AutoLock autolock(cancelled_lock_); | 215 base::AutoLock autolock(cancelled_lock_); |
215 bool result = cancelled_; | 216 bool result = cancelled_; |
216 return result; | 217 return result; |
217 } | 218 } |
218 | 219 |
219 ContentHashFetcherJob::~ContentHashFetcherJob() { | 220 ContentHashFetcherJob::~ContentHashFetcherJob() { |
220 } | 221 } |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
437 timer.Elapsed()); | 438 timer.Elapsed()); |
438 return result; | 439 return result; |
439 } | 440 } |
440 | 441 |
441 void ContentHashFetcherJob::DispatchCallback() { | 442 void ContentHashFetcherJob::DispatchCallback() { |
442 { | 443 { |
443 base::AutoLock autolock(cancelled_lock_); | 444 base::AutoLock autolock(cancelled_lock_); |
444 if (cancelled_) | 445 if (cancelled_) |
445 return; | 446 return; |
446 } | 447 } |
448 url_fetcher_.reset(); | |
lazyboy
2017/04/13 02:06:35
btw, this is the reset that's necessary for the te
Devlin
2017/04/13 15:12:18
Where is the reference to ContentHashFetcherJob in
lazyboy
2017/04/13 16:06:24
You're right, I got too excited yesterday and didn
Devlin
2017/04/13 16:24:45
Hmm...
It makes sense why that would solve the pr
| |
447 callback_.Run(this); | 449 callback_.Run(this); |
448 } | 450 } |
449 | 451 |
450 // ---- | 452 // ---- |
451 | 453 |
452 ContentHashFetcher::ContentHashFetcher( | 454 ContentHashFetcher::ContentHashFetcher( |
453 net::URLRequestContextGetter* context_getter, | 455 net::URLRequestContextGetter* context_getter, |
454 ContentVerifierDelegate* delegate, | 456 ContentVerifierDelegate* delegate, |
455 const FetchCallback& callback) | 457 const FetchCallback& callback) |
456 : context_getter_(context_getter), | 458 : context_getter_(context_getter), |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
522 | 524 |
523 for (JobMap::iterator i = jobs_.begin(); i != jobs_.end(); ++i) { | 525 for (JobMap::iterator i = jobs_.begin(); i != jobs_.end(); ++i) { |
524 if (i->second.get() == job) { | 526 if (i->second.get() == job) { |
525 jobs_.erase(i); | 527 jobs_.erase(i); |
526 break; | 528 break; |
527 } | 529 } |
528 } | 530 } |
529 } | 531 } |
530 | 532 |
531 } // namespace extensions | 533 } // namespace extensions |
OLD | NEW |