Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef DocumentLifecycle_h | 31 #ifndef ResourceLoadPriorityOptimizer_h |
| 32 #define DocumentLifecycle_h | 32 #define ResourceLoadPriorityOptimizer_h |
| 33 | 33 |
| 34 #include "wtf/Noncopyable.h" | 34 #include "core/fetch/ImageResource.h" |
| 35 #include "core/fetch/ResourcePtr.h" | |
| 36 | |
| 37 #include <map> | |
| 35 | 38 |
| 36 namespace WebCore { | 39 namespace WebCore { |
| 37 | 40 |
| 38 class DocumentLifecycle { | 41 class ResourceLoadPriorityOptimizer { |
| 39 WTF_MAKE_NONCOPYABLE(DocumentLifecycle); | |
| 40 public: | 42 public: |
| 41 enum State { | 43 ResourceLoadPriorityOptimizer(); |
| 42 Uninitialized, | 44 ~ResourceLoadPriorityOptimizer(); |
| 43 Inactive, | 45 void notifyImageResourceVisibility(ImageResource*, bool); |
|
eseidel
2013/11/25 23:59:30
Bools make awful args. We try to use Enums when p
shatch
2013/11/26 01:35:18
Done.
| |
| 44 Active, | 46 |
| 45 Stopping, | 47 private: |
| 46 Stopped, | 48 void updateImageResourcesWithLoadPriority(); |
| 47 Disposed, | 49 |
| 50 struct ResourceAndVisibility { | |
| 51 ResourceAndVisibility(ImageResource*, bool); | |
| 52 ResourceAndVisibility(); | |
| 53 ResourceAndVisibility(const ResourceAndVisibility&); | |
| 54 ~ResourceAndVisibility(); | |
| 55 ResourcePtr<ImageResource> imageResource; | |
| 56 bool visible; | |
| 48 }; | 57 }; |
| 49 | 58 |
| 50 DocumentLifecycle(); | 59 typedef std::map<unsigned long, ResourceAndVisibility> ImageResourceMap; |
|
eseidel
2013/11/25 23:59:30
I don't recall. Is "unsigned long" actually diffe
shatch
2013/11/26 01:35:18
I'm not sure if they're different? A quick search
| |
| 51 ~DocumentLifecycle(); | 60 ImageResourceMap m_imageResources; |
| 52 | |
| 53 State state() const { return m_state; } | |
| 54 | |
| 55 void advanceTo(State); | |
| 56 | |
| 57 private: | |
| 58 State m_state; | |
| 59 }; | 61 }; |
| 60 | 62 |
| 61 } | 63 } |
| 62 | 64 |
| 63 #endif | 65 #endif |
| OLD | NEW |