Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
| 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
| 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
| 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
| 7 rights reserved. | 7 rights reserved. |
| 8 | 8 |
| 9 This library is free software; you can redistribute it and/or | 9 This library is free software; you can redistribute it and/or |
| 10 modify it under the terms of the GNU Library General Public | 10 modify it under the terms of the GNU Library General Public |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 m_cacheIdentifier(MemoryCache::defaultCacheIdentifier()), | 310 m_cacheIdentifier(MemoryCache::defaultCacheIdentifier()), |
| 311 m_preloadResult(PreloadNotReferenced), | 311 m_preloadResult(PreloadNotReferenced), |
| 312 m_type(type), | 312 m_type(type), |
| 313 m_status(NotStarted), | 313 m_status(NotStarted), |
| 314 m_needsSynchronousCacheHit(false), | 314 m_needsSynchronousCacheHit(false), |
| 315 m_linkPreload(false), | 315 m_linkPreload(false), |
| 316 m_isRevalidating(false), | 316 m_isRevalidating(false), |
| 317 m_isAlive(false), | 317 m_isAlive(false), |
| 318 m_integrityDisposition(ResourceIntegrityDisposition::NotChecked), | 318 m_integrityDisposition(ResourceIntegrityDisposition::NotChecked), |
| 319 m_isAddRemoveClientProhibited(false), | 319 m_isAddRemoveClientProhibited(false), |
| 320 m_isNotifyClientsOfCompletionProhibited(false), | |
|
Nate Chapin
2016/10/10 23:47:49
I'm suspicious this can be on ImageResource instea
sclittle
2016/10/11 02:56:56
Only the completion callbacks are being suppressed
Nate Chapin
2016/10/12 22:56:17
I'm not certain how much of a risk this is in prac
sclittle
2016/10/12 23:38:16
Good point, sorry, I forgot about ImageResource::d
| |
| 320 m_options(options), | 321 m_options(options), |
| 321 m_responseTimestamp(currentTime()), | 322 m_responseTimestamp(currentTime()), |
| 322 m_cancelTimer(this, &Resource::cancelTimerFired), | 323 m_cancelTimer(this, &Resource::cancelTimerFired), |
| 323 m_resourceRequest(request) { | 324 m_resourceRequest(request) { |
| 324 // m_type is a bitfield, so this tests careless updates of the enum. | 325 // m_type is a bitfield, so this tests careless updates of the enum. |
| 325 DCHECK_EQ(m_type, unsigned(type)); | 326 DCHECK_EQ(m_type, unsigned(type)); |
| 326 InstanceCounters::incrementCounter(InstanceCounters::ResourceCounter); | 327 InstanceCounters::incrementCounter(InstanceCounters::ResourceCounter); |
| 327 | 328 |
| 328 // Currently we support the metadata caching only for HTTP family. | 329 // Currently we support the metadata caching only for HTTP family. |
| 329 if (m_resourceRequest.url().protocolIsInHTTPFamily()) | 330 if (m_resourceRequest.url().protocolIsInHTTPFamily()) |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 349 DCHECK(stillNeedsLoad()); | 350 DCHECK(stillNeedsLoad()); |
| 350 m_loader = loader; | 351 m_loader = loader; |
| 351 m_status = Pending; | 352 m_status = Pending; |
| 352 } | 353 } |
| 353 | 354 |
| 354 void Resource::checkNotify() { | 355 void Resource::checkNotify() { |
| 355 notifyClientsInternal(MarkFinishedOption::ShouldMarkFinished); | 356 notifyClientsInternal(MarkFinishedOption::ShouldMarkFinished); |
| 356 } | 357 } |
| 357 | 358 |
| 358 void Resource::notifyClientsInternal(MarkFinishedOption markFinishedOption) { | 359 void Resource::notifyClientsInternal(MarkFinishedOption markFinishedOption) { |
| 359 if (isLoading()) | 360 if (isLoading() || m_isNotifyClientsOfCompletionProhibited) |
| 360 return; | 361 return; |
| 361 | 362 |
| 362 ResourceClientWalker<ResourceClient> w(m_clients); | 363 ResourceClientWalker<ResourceClient> w(m_clients); |
| 363 while (ResourceClient* c = w.next()) { | 364 while (ResourceClient* c = w.next()) { |
| 364 if (markFinishedOption == MarkFinishedOption::ShouldMarkFinished) | 365 if (markFinishedOption == MarkFinishedOption::ShouldMarkFinished) |
| 365 markClientFinished(c); | 366 markClientFinished(c); |
| 366 c->notifyFinished(this); | 367 c->notifyFinished(this); |
| 367 } | 368 } |
| 368 } | 369 } |
| 369 | 370 |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 649 } | 650 } |
| 650 if (memoryCache()->contains(this)) { | 651 if (memoryCache()->contains(this)) { |
| 651 if (!builder.isEmpty()) | 652 if (!builder.isEmpty()) |
| 652 builder.append(' '); | 653 builder.append(' '); |
| 653 builder.append("in_memory_cache"); | 654 builder.append("in_memory_cache"); |
| 654 } | 655 } |
| 655 return builder.toString(); | 656 return builder.toString(); |
| 656 } | 657 } |
| 657 | 658 |
| 658 void Resource::didAddClient(ResourceClient* c) { | 659 void Resource::didAddClient(ResourceClient* c) { |
| 659 if (isLoaded()) { | 660 if (isLoaded() && !m_isNotifyClientsOfCompletionProhibited) { |
| 660 c->notifyFinished(this); | 661 c->notifyFinished(this); |
| 661 if (m_clients.contains(c)) { | 662 if (m_clients.contains(c)) { |
| 662 m_finishedClients.add(c); | 663 m_finishedClients.add(c); |
| 663 m_clients.remove(c); | 664 m_clients.remove(c); |
| 664 } | 665 } |
| 665 } | 666 } |
| 666 } | 667 } |
| 667 | 668 |
| 668 static bool shouldSendCachedDataSynchronouslyForType(Resource::Type type) { | 669 static bool shouldSendCachedDataSynchronouslyForType(Resource::Type type) { |
| 669 // Some resources types default to return data synchronously. For most of | 670 // Some resources types default to return data synchronously. For most of |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1097 case Resource::TextTrack: | 1098 case Resource::TextTrack: |
| 1098 case Resource::Media: | 1099 case Resource::Media: |
| 1099 case Resource::Manifest: | 1100 case Resource::Manifest: |
| 1100 return false; | 1101 return false; |
| 1101 } | 1102 } |
| 1102 NOTREACHED(); | 1103 NOTREACHED(); |
| 1103 return false; | 1104 return false; |
| 1104 } | 1105 } |
| 1105 | 1106 |
| 1106 } // namespace blink | 1107 } // namespace blink |
| OLD | NEW |