| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // Invoked when the pending script has finished loading. This could be during | 47 // Invoked when the pending script has finished loading. This could be during |
| 48 // |watchForLoad| (if the pending script was already ready), or when the | 48 // |watchForLoad| (if the pending script was already ready), or when the |
| 49 // resource loads (if script streaming is not occurring), or when script | 49 // resource loads (if script streaming is not occurring), or when script |
| 50 // streaming finishes. | 50 // streaming finishes. |
| 51 virtual void PendingScriptFinished(PendingScript*) = 0; | 51 virtual void PendingScriptFinished(PendingScript*) = 0; |
| 52 | 52 |
| 53 DEFINE_INLINE_VIRTUAL_TRACE() {} | 53 DEFINE_INLINE_VIRTUAL_TRACE() {} |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 class CORE_EXPORT PendingScript | 56 class CORE_EXPORT PendingScript |
| 57 : public GarbageCollectedFinalized<PendingScript> { | 57 : public GarbageCollectedFinalized<PendingScript>, |
| 58 public TraceWrapperBase { |
| 58 USING_PRE_FINALIZER(PendingScript, Dispose); | 59 USING_PRE_FINALIZER(PendingScript, Dispose); |
| 59 WTF_MAKE_NONCOPYABLE(PendingScript); | 60 WTF_MAKE_NONCOPYABLE(PendingScript); |
| 60 | 61 |
| 61 public: | 62 public: |
| 62 virtual ~PendingScript(); | 63 virtual ~PendingScript(); |
| 63 | 64 |
| 64 TextPosition StartingPosition() const { return starting_position_; } | 65 TextPosition StartingPosition() const { return starting_position_; } |
| 65 void MarkParserBlockingLoadStartTime(); | 66 void MarkParserBlockingLoadStartTime(); |
| 66 // Returns the time the load of this script started blocking the parser, or | 67 // Returns the time the load of this script started blocking the parser, or |
| 67 // zero if this script hasn't yet blocked the parser, in | 68 // zero if this script hasn't yet blocked the parser, in |
| 68 // monotonicallyIncreasingTime. | 69 // monotonicallyIncreasingTime. |
| 69 double ParserBlockingLoadStartTime() const { | 70 double ParserBlockingLoadStartTime() const { |
| 70 return parser_blocking_load_start_time_; | 71 return parser_blocking_load_start_time_; |
| 71 } | 72 } |
| 72 | 73 |
| 73 void WatchForLoad(PendingScriptClient*); | 74 void WatchForLoad(PendingScriptClient*); |
| 74 void StopWatchingForLoad(); | 75 void StopWatchingForLoad(); |
| 75 | 76 |
| 76 ScriptElementBase* GetElement() const; | 77 ScriptElementBase* GetElement() const; |
| 77 | 78 |
| 78 virtual ScriptType GetScriptType() const = 0; | 79 virtual ScriptType GetScriptType() const = 0; |
| 79 | 80 |
| 80 DECLARE_VIRTUAL_TRACE(); | 81 DECLARE_VIRTUAL_TRACE(); |
| 82 DECLARE_VIRTUAL_TRACE_WRAPPERS(); |
| 81 | 83 |
| 82 virtual Script* GetSource(const KURL& document_url, | 84 virtual Script* GetSource(const KURL& document_url, |
| 83 bool& error_occurred) const = 0; | 85 bool& error_occurred) const = 0; |
| 84 | 86 |
| 85 // https://html.spec.whatwg.org/#the-script-is-ready | 87 // https://html.spec.whatwg.org/#the-script-is-ready |
| 86 virtual bool IsReady() const = 0; | 88 virtual bool IsReady() const = 0; |
| 87 | 89 |
| 88 virtual KURL Url() const = 0; | 90 virtual KURL Url() const = 0; |
| 89 virtual bool IsExternal() const = 0; | 91 virtual bool IsExternal() const = 0; |
| 90 virtual bool ErrorOccurred() const = 0; | 92 virtual bool ErrorOccurred() const = 0; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 117 | 119 |
| 118 TextPosition starting_position_; // Only used for inline script tags. | 120 TextPosition starting_position_; // Only used for inline script tags. |
| 119 double parser_blocking_load_start_time_; | 121 double parser_blocking_load_start_time_; |
| 120 | 122 |
| 121 Member<PendingScriptClient> client_; | 123 Member<PendingScriptClient> client_; |
| 122 }; | 124 }; |
| 123 | 125 |
| 124 } // namespace blink | 126 } // namespace blink |
| 125 | 127 |
| 126 #endif // PendingScript_h | 128 #endif // PendingScript_h |
| OLD | NEW |