OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "platform/heap/Handle.h" | 30 #include "platform/heap/Handle.h" |
31 #include "wtf/Allocator.h" | 31 #include "wtf/Allocator.h" |
32 #include "wtf/Forward.h" | 32 #include "wtf/Forward.h" |
33 #include "wtf/HashMap.h" | 33 #include "wtf/HashMap.h" |
34 #include "wtf/Noncopyable.h" | 34 #include "wtf/Noncopyable.h" |
35 #include "wtf/OwnPtr.h" | 35 #include "wtf/OwnPtr.h" |
36 | 36 |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
39 class LocalFrame; | 39 class LocalFrame; |
| 40 class Resource; |
40 class ResourceResponse; | 41 class ResourceResponse; |
41 struct ProgressItem; | 42 struct ProgressItem; |
42 | 43 |
43 // FIXME: This is only used on Android. Android is the only Chrome | 44 // FIXME: This is only used on Android. Android is the only Chrome |
44 // browser which shows a progress bar during loading. | 45 // browser which shows a progress bar during loading. |
45 // We should find a better way for Android to get this data and remove this! | 46 // We should find a better way for Android to get this data and remove this! |
46 class CORE_EXPORT ProgressTracker final : public GarbageCollectedFinalized<Progr
essTracker> { | 47 class CORE_EXPORT ProgressTracker final : public GarbageCollectedFinalized<Progr
essTracker> { |
47 WTF_MAKE_NONCOPYABLE(ProgressTracker); | 48 WTF_MAKE_NONCOPYABLE(ProgressTracker); |
48 public: | 49 public: |
49 static ProgressTracker* create(LocalFrame*); | 50 static ProgressTracker* create(LocalFrame*); |
50 | 51 |
51 ~ProgressTracker(); | 52 ~ProgressTracker(); |
52 DECLARE_TRACE(); | 53 DECLARE_TRACE(); |
53 void dispose(); | 54 void dispose(); |
54 | 55 |
55 double estimatedProgress() const; | 56 double estimatedProgress() const; |
56 | 57 |
57 void progressStarted(); | 58 void progressStarted(); |
58 void progressCompleted(); | 59 void progressCompleted(); |
59 | 60 |
60 void finishedParsing(); | 61 void finishedParsing(); |
61 | 62 |
| 63 void willStartLoading(unsigned long identifier); |
62 void incrementProgress(unsigned long identifier, const ResourceResponse&); | 64 void incrementProgress(unsigned long identifier, const ResourceResponse&); |
63 void incrementProgress(unsigned long identifier, int); | 65 void incrementProgress(unsigned long identifier, int); |
64 void completeProgress(unsigned long identifier); | 66 void completeProgress(unsigned long identifier); |
65 | 67 |
66 long long totalPageAndResourceBytesToLoad() const { return m_totalPageAndRes
ourceBytesToLoad; } | |
67 long long totalBytesReceived() const { return m_totalBytesReceived; } | |
68 | |
69 private: | 68 private: |
70 explicit ProgressTracker(LocalFrame*); | 69 explicit ProgressTracker(LocalFrame*); |
71 | 70 |
72 void incrementProgressForMainResourceOnly(unsigned long identifier, int leng
th); | 71 void incrementProgressForMainResourceOnly(unsigned long identifier, int leng
th); |
| 72 void maybeSendProgress(); |
73 void sendFinalProgress(); | 73 void sendFinalProgress(); |
74 void reset(); | 74 void reset(); |
75 | 75 |
76 Member<LocalFrame> m_frame; | 76 Member<LocalFrame> m_frame; |
77 unsigned long m_mainResourceIdentifier; | |
78 long long m_totalPageAndResourceBytesToLoad; | |
79 long long m_totalBytesReceived; | |
80 double m_lastNotifiedProgressValue; | 77 double m_lastNotifiedProgressValue; |
81 double m_lastNotifiedProgressTime; | 78 double m_lastNotifiedProgressTime; |
82 double m_progressNotificationInterval; | 79 double m_progressNotificationInterval; |
83 double m_progressNotificationTimeInterval; | 80 double m_progressNotificationTimeInterval; |
| 81 bool m_finishedParsing; |
84 bool m_finalProgressChangedSent; | 82 bool m_finalProgressChangedSent; |
85 double m_progressValue; | 83 double m_progressValue; |
86 | 84 |
87 HashMap<unsigned long, OwnPtr<ProgressItem>> m_progressItems; | 85 HashMap<unsigned long, OwnPtr<ProgressItem>> m_progressItems; |
88 }; | 86 }; |
89 | 87 |
90 } // namespace blink | 88 } // namespace blink |
91 | 89 |
92 #endif | 90 #endif |
OLD | NEW |