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 rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
| 7 | 7 |
| 8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
| 9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
| 10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 649 { | 649 { |
| 650 if (isLoaded()) { | 650 if (isLoaded()) { |
| 651 c->notifyFinished(this); | 651 c->notifyFinished(this); |
| 652 if (m_clients.contains(c)) { | 652 if (m_clients.contains(c)) { |
| 653 m_finishedClients.add(c); | 653 m_finishedClients.add(c); |
| 654 m_clients.remove(c); | 654 m_clients.remove(c); |
| 655 } | 655 } |
| 656 } | 656 } |
| 657 } | 657 } |
| 658 | 658 |
| 659 static bool shouldSendCachedDataSynchronouslyForType(Resource::Type type) | 659 static bool shouldSendCachedDataOrErrorSynchronouslyForType(Resource::Type type) |
|
Nate Chapin
2016/08/09 22:43:23
This name was already too long :/ Maybe typeNeeds
engedy
2016/08/17 16:41:56
Done.
| |
| 660 { | 660 { |
| 661 // Some resources types default to return data synchronously. | 661 // Some resources types default to return data synchronously. |
| 662 // For most of these, it's because there are layout tests that | 662 // For most of these, it's because there are layout tests that |
| 663 // expect data to return synchronously in case of cache hit. In | 663 // expect data to return synchronously in case of cache hit. In |
| 664 // the case of fonts, there was a performance regression. | 664 // the case of fonts, there was a performance regression. |
| 665 // FIXME: Get to the point where we don't need to special-case sync/async | 665 // FIXME: Get to the point where we don't need to special-case sync/async |
| 666 // behavior for different resource types. | 666 // behavior for different resource types. |
| 667 if (type == Resource::Image) | 667 if (type == Resource::Image) |
| 668 return true; | 668 return true; |
| 669 if (type == Resource::CSSStyleSheet) | 669 if (type == Resource::CSSStyleSheet) |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 698 | 698 |
| 699 void Resource::addClient(ResourceClient* client) | 699 void Resource::addClient(ResourceClient* client) |
| 700 { | 700 { |
| 701 willAddClientOrObserver(); | 701 willAddClientOrObserver(); |
| 702 | 702 |
| 703 if (m_isRevalidating) { | 703 if (m_isRevalidating) { |
| 704 m_clients.add(client); | 704 m_clients.add(client); |
| 705 return; | 705 return; |
| 706 } | 706 } |
| 707 | 707 |
| 708 // If we have existing data to send to the new client and the resource type supprts it, send it asynchronously. | 708 // If an error has occurred or we have existing data to send to the new clie nt and the resource type supprts it, send it asynchronously. |
| 709 if (!m_response.isNull() && !shouldSendCachedDataSynchronouslyForType(getTyp e()) && !m_needsSynchronousCacheHit) { | 709 if ((errorOccurred() || !m_response.isNull()) && !shouldSendCachedDataOrErro rSynchronouslyForType(getType()) && !m_needsSynchronousCacheHit) { |
| 710 m_clientsAwaitingCallback.add(client); | 710 m_clientsAwaitingCallback.add(client); |
| 711 ResourceCallback::callbackHandler().schedule(this); | 711 ResourceCallback::callbackHandler().schedule(this); |
| 712 return; | 712 return; |
| 713 } | 713 } |
| 714 | 714 |
| 715 m_clients.add(client); | 715 m_clients.add(client); |
| 716 didAddClient(client); | 716 didAddClient(client); |
| 717 return; | 717 return; |
| 718 } | 718 } |
| 719 | 719 |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1112 case Resource::TextTrack: | 1112 case Resource::TextTrack: |
| 1113 case Resource::Media: | 1113 case Resource::Media: |
| 1114 case Resource::Manifest: | 1114 case Resource::Manifest: |
| 1115 return false; | 1115 return false; |
| 1116 } | 1116 } |
| 1117 ASSERT_NOT_REACHED(); | 1117 ASSERT_NOT_REACHED(); |
| 1118 return false; | 1118 return false; |
| 1119 } | 1119 } |
| 1120 | 1120 |
| 1121 } // namespace blink | 1121 } // namespace blink |
| OLD | NEW |