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 * 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 ~ScriptRunner(); | 51 ~ScriptRunner(); |
52 | 52 |
53 enum ExecutionType { ASYNC_EXECUTION, IN_ORDER_EXECUTION }; | 53 enum ExecutionType { ASYNC_EXECUTION, IN_ORDER_EXECUTION }; |
54 void queueScriptForExecution(ScriptLoader*, ResourcePtr<ScriptResource>, Exe
cutionType); | 54 void queueScriptForExecution(ScriptLoader*, ResourcePtr<ScriptResource>, Exe
cutionType); |
55 bool hasPendingScripts() const { return !m_scriptsToExecuteSoon.isEmpty() ||
!m_scriptsToExecuteInOrder.isEmpty() || !m_pendingAsyncScripts.isEmpty(); } | 55 bool hasPendingScripts() const { return !m_scriptsToExecuteSoon.isEmpty() ||
!m_scriptsToExecuteInOrder.isEmpty() || !m_pendingAsyncScripts.isEmpty(); } |
56 void suspend(); | 56 void suspend(); |
57 void resume(); | 57 void resume(); |
58 void notifyScriptReady(ScriptLoader*, ExecutionType); | 58 void notifyScriptReady(ScriptLoader*, ExecutionType); |
59 void notifyScriptLoadError(ScriptLoader*, ExecutionType); | 59 void notifyScriptLoadError(ScriptLoader*, ExecutionType); |
60 | 60 |
| 61 void movePendingAsyncScript(ScriptRunner*, ScriptLoader*); |
| 62 |
61 void trace(Visitor*); | 63 void trace(Visitor*); |
62 | 64 |
63 private: | 65 private: |
64 explicit ScriptRunner(Document*); | 66 explicit ScriptRunner(Document*); |
65 | 67 |
66 void timerFired(Timer<ScriptRunner>*); | 68 void timerFired(Timer<ScriptRunner>*); |
67 | 69 |
| 70 void addPendingAsyncScript(ScriptLoader*, const PendingScript&); |
| 71 |
68 RawPtrWillBeMember<Document> m_document; | 72 RawPtrWillBeMember<Document> m_document; |
69 // FIXME: Oilpan: consider using heap vectors and hash map here; | 73 // FIXME: Oilpan: consider using heap vectors and hash map here; |
70 // PendingScript does have a (trivial) destructor, however. | 74 // PendingScript does have a (trivial) destructor, however. |
71 Vector<PendingScript> m_scriptsToExecuteInOrder; | 75 Vector<PendingScript> m_scriptsToExecuteInOrder; |
72 Vector<PendingScript> m_scriptsToExecuteSoon; // http://www.whatwg.org/specs
/web-apps/current-work/#set-of-scripts-that-will-execute-as-soon-as-possible | 76 Vector<PendingScript> m_scriptsToExecuteSoon; // http://www.whatwg.org/specs
/web-apps/current-work/#set-of-scripts-that-will-execute-as-soon-as-possible |
73 WillBeHeapHashMap<ScriptLoader*, PendingScript> m_pendingAsyncScripts; | 77 WillBeHeapHashMap<ScriptLoader*, PendingScript> m_pendingAsyncScripts; |
74 Timer<ScriptRunner> m_timer; | 78 Timer<ScriptRunner> m_timer; |
75 }; | 79 }; |
76 | 80 |
77 } | 81 } |
78 | 82 |
79 #endif | 83 #endif |
OLD | NEW |