| 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 27 matching lines...) Expand all Loading... |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 class Element; | 40 class Element; |
| 41 class ScriptSourceCode; | 41 class ScriptSourceCode; |
| 42 | 42 |
| 43 // A container for an external script which may be loaded and executed. | 43 // A container for an external script which may be loaded and executed. |
| 44 // | 44 // |
| 45 // A RefPtr alone does not prevent the underlying Resource | 45 // A RefPtr alone does not prevent the underlying Resource |
| 46 // from purging its data buffer. This class holds a dummy client open for its | 46 // from purging its data buffer. This class holds a dummy client open for its |
| 47 // lifetime in order to guarantee that the data buffer will not be purged. | 47 // lifetime in order to guarantee that the data buffer will not be purged. |
| 48 class CORE_EXPORT PendingScript final : public NoBaseWillBeGarbageCollectedFinal
ized<PendingScript>, public ResourceOwner<ScriptResource> { | 48 class CORE_EXPORT PendingScript final : public GarbageCollectedFinalized<Pending
Script>, public ResourceOwner<ScriptResource> { |
| 49 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PendingScript); | 49 USING_GARBAGE_COLLECTED_MIXIN(PendingScript); |
| 50 WILL_BE_USING_PRE_FINALIZER(PendingScript, dispose); | 50 USING_PRE_FINALIZER(PendingScript, dispose); |
| 51 public: | 51 public: |
| 52 static PassOwnPtrWillBeRawPtr<PendingScript> create(Element*, ScriptResource
*); | 52 static RawPtr<PendingScript> create(Element*, ScriptResource*); |
| 53 ~PendingScript() override; | 53 ~PendingScript() override; |
| 54 | 54 |
| 55 PendingScript& operator=(const PendingScript&); | 55 PendingScript& operator=(const PendingScript&); |
| 56 | 56 |
| 57 TextPosition startingPosition() const { return m_startingPosition; } | 57 TextPosition startingPosition() const { return m_startingPosition; } |
| 58 void setStartingPosition(const TextPosition& position) { m_startingPosition
= position; } | 58 void setStartingPosition(const TextPosition& position) { m_startingPosition
= position; } |
| 59 | 59 |
| 60 void watchForLoad(ScriptResourceClient*); | 60 void watchForLoad(ScriptResourceClient*); |
| 61 void stopWatchingForLoad(); | 61 void stopWatchingForLoad(); |
| 62 | 62 |
| 63 Element* element() const { return m_element.get(); } | 63 Element* element() const { return m_element.get(); } |
| 64 void setElement(Element*); | 64 void setElement(Element*); |
| 65 PassRefPtrWillBeRawPtr<Element> releaseElementAndClear(); | 65 RawPtr<Element> releaseElementAndClear(); |
| 66 | 66 |
| 67 void setScriptResource(ScriptResource*); | 67 void setScriptResource(ScriptResource*); |
| 68 | 68 |
| 69 void notifyFinished(Resource*) override; | 69 void notifyFinished(Resource*) override; |
| 70 String debugName() const override { return "PendingScript"; } | 70 String debugName() const override { return "PendingScript"; } |
| 71 void notifyAppendData(ScriptResource*) override; | 71 void notifyAppendData(ScriptResource*) override; |
| 72 | 72 |
| 73 DECLARE_TRACE(); | 73 DECLARE_TRACE(); |
| 74 | 74 |
| 75 ScriptSourceCode getSource(const KURL& documentURL, bool& errorOccurred) con
st; | 75 ScriptSourceCode getSource(const KURL& documentURL, bool& errorOccurred) con
st; |
| 76 | 76 |
| 77 void setStreamer(PassRefPtrWillBeRawPtr<ScriptStreamer>); | 77 void setStreamer(RawPtr<ScriptStreamer>); |
| 78 void streamingFinished(); | 78 void streamingFinished(); |
| 79 | 79 |
| 80 bool isReady() const; | 80 bool isReady() const; |
| 81 bool errorOccurred() const; | 81 bool errorOccurred() const; |
| 82 | 82 |
| 83 void dispose(); | 83 void dispose(); |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 PendingScript(Element*, ScriptResource*); | 86 PendingScript(Element*, ScriptResource*); |
| 87 | 87 |
| 88 bool m_watchingForLoad; | 88 bool m_watchingForLoad; |
| 89 RefPtrWillBeMember<Element> m_element; | 89 Member<Element> m_element; |
| 90 TextPosition m_startingPosition; // Only used for inline script tags. | 90 TextPosition m_startingPosition; // Only used for inline script tags. |
| 91 bool m_integrityFailure; | 91 bool m_integrityFailure; |
| 92 | 92 |
| 93 RefPtrWillBeMember<ScriptStreamer> m_streamer; | 93 Member<ScriptStreamer> m_streamer; |
| 94 ScriptResourceClient* m_client; | 94 ScriptResourceClient* m_client; |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 } // namespace blink | 97 } // namespace blink |
| 98 | 98 |
| 99 #endif // PendingScript_h | 99 #endif // PendingScript_h |
| OLD | NEW |