OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * 3. Neither the name of Google, Inc. nor the names of | 13 * 3. Neither the name of Google, Inc. nor the names of |
14 * its contributors may be used to endorse or promote products derived | 14 * its contributors may be used to endorse or promote products derived |
15 * from this software without specific prior written permission. | 15 * from this software without specific prior written permission. |
16 * | 16 * |
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" A
ND ANY | 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 18 * AND ANY |
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | 21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 28 */ |
28 | 29 |
29 #ifndef FrameLoaderStateMachine_h | 30 #ifndef FrameLoaderStateMachine_h |
30 #define FrameLoaderStateMachine_h | 31 #define FrameLoaderStateMachine_h |
31 | 32 |
32 #include "core/CoreExport.h" | 33 #include "core/CoreExport.h" |
33 #include "wtf/Allocator.h" | 34 #include "wtf/Allocator.h" |
34 #include "wtf/Noncopyable.h" | 35 #include "wtf/Noncopyable.h" |
35 #include "wtf/text/WTFString.h" | 36 #include "wtf/text/WTFString.h" |
36 | 37 |
37 namespace blink { | 38 namespace blink { |
38 | 39 |
39 // Encapsulates a state machine for FrameLoader. Note that this is different fro
m FrameState, | 40 // Encapsulates a state machine for FrameLoader. Note that this is different |
40 // which stores the state of the current load that FrameLoader is executing. | 41 // from FrameState, which stores the state of the current load that FrameLoader |
| 42 // is executing. |
41 class CORE_EXPORT FrameLoaderStateMachine { | 43 class CORE_EXPORT FrameLoaderStateMachine { |
42 DISALLOW_NEW(); | 44 DISALLOW_NEW(); |
43 WTF_MAKE_NONCOPYABLE(FrameLoaderStateMachine); | 45 WTF_MAKE_NONCOPYABLE(FrameLoaderStateMachine); |
44 | 46 |
45 public: | 47 public: |
46 FrameLoaderStateMachine(); | 48 FrameLoaderStateMachine(); |
47 | 49 |
48 // Once a load has been committed, the state may | 50 // Once a load has been committed, the state may alternate between |
49 // alternate between CommittedFirstRealLoad and FirstLayoutDone. | 51 // CommittedFirstRealLoad and FirstLayoutDone. Otherwise, the states only go |
50 // Otherwise, the states only go down the list. | 52 // down the list. |
51 enum State { | 53 enum State { |
52 CreatingInitialEmptyDocument, | 54 CreatingInitialEmptyDocument, |
53 DisplayingInitialEmptyDocument, | 55 DisplayingInitialEmptyDocument, |
54 CommittedFirstRealLoad, | 56 CommittedFirstRealLoad, |
55 CommittedMultipleRealLoads | 57 CommittedMultipleRealLoads |
56 }; | 58 }; |
57 | 59 |
58 bool committedFirstRealDocumentLoad() const; | 60 bool committedFirstRealDocumentLoad() const; |
59 bool creatingInitialEmptyDocument() const; | 61 bool creatingInitialEmptyDocument() const; |
60 bool isDisplayingInitialEmptyDocument() const; | 62 bool isDisplayingInitialEmptyDocument() const; |
61 bool committedMultipleRealLoads() const; | 63 bool committedMultipleRealLoads() const; |
62 void advanceTo(State); | 64 void advanceTo(State); |
63 | 65 |
64 String toString() const; | 66 String toString() const; |
65 | 67 |
66 private: | 68 private: |
67 State m_state; | 69 State m_state; |
68 }; | 70 }; |
69 | 71 |
70 } // namespace blink | 72 } // namespace blink |
71 | 73 |
72 #endif // FrameLoaderStateMachine_h | 74 #endif // FrameLoaderStateMachine_h |
OLD | NEW |