Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.h

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ScriptStreamer_h 5 #ifndef ScriptStreamer_h
6 #define ScriptStreamer_h 6 #define ScriptStreamer_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "platform/heap/Handle.h" 9 #include "platform/heap/Handle.h"
10 #include "wtf/RefCounted.h" 10 #include "wtf/RefCounted.h"
(...skipping 10 matching lines...) Expand all
21 class SourceStream; 21 class SourceStream;
22 class WebTaskRunner; 22 class WebTaskRunner;
23 23
24 // ScriptStreamer streams incomplete script data to V8 so that it can be parsed 24 // ScriptStreamer streams incomplete script data to V8 so that it can be parsed
25 // while it's loaded. PendingScript holds a reference to ScriptStreamer. At the 25 // while it's loaded. PendingScript holds a reference to ScriptStreamer. At the
26 // moment, ScriptStreamer is only used for parser blocking scripts; this means 26 // moment, ScriptStreamer is only used for parser blocking scripts; this means
27 // that the Document stays stable and no other scripts are executing while we're 27 // that the Document stays stable and no other scripts are executing while we're
28 // streaming. It is possible, though, that Document and the PendingScript are 28 // streaming. It is possible, though, that Document and the PendingScript are
29 // destroyed while the streaming is in progress, and ScriptStreamer handles it 29 // destroyed while the streaming is in progress, and ScriptStreamer handles it
30 // gracefully. 30 // gracefully.
31 class CORE_EXPORT ScriptStreamer final : public RefCountedWillBeRefCountedGarbag eCollected<ScriptStreamer> { 31 class CORE_EXPORT ScriptStreamer final : public RefCountedGarbageCollected<Scrip tStreamer> {
32 WTF_MAKE_NONCOPYABLE(ScriptStreamer); 32 WTF_MAKE_NONCOPYABLE(ScriptStreamer);
33 public: 33 public:
34 enum Type { 34 enum Type {
35 ParsingBlocking, 35 ParsingBlocking,
36 Deferred, 36 Deferred,
37 Async 37 Async
38 }; 38 };
39 39
40 ~ScriptStreamer(); 40 ~ScriptStreamer();
41 DECLARE_TRACE(); 41 DECLARE_TRACE();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 s_smallScriptThreshold = threshold; 87 s_smallScriptThreshold = threshold;
88 } 88 }
89 89
90 static size_t smallScriptThreshold() { return s_smallScriptThreshold; } 90 static size_t smallScriptThreshold() { return s_smallScriptThreshold; }
91 91
92 private: 92 private:
93 // Scripts whose first data chunk is smaller than this constant won't be 93 // Scripts whose first data chunk is smaller than this constant won't be
94 // streamed. Non-const for testing. 94 // streamed. Non-const for testing.
95 static size_t s_smallScriptThreshold; 95 static size_t s_smallScriptThreshold;
96 96
97 static PassRefPtrWillBeRawPtr<ScriptStreamer> create(PendingScript* script, Type scriptType, ScriptState* scriptState, v8::ScriptCompiler::CompileOptions co mpileOptions, WebTaskRunner* loadingTaskRunner) 97 static RawPtr<ScriptStreamer> create(PendingScript* script, Type scriptType, ScriptState* scriptState, v8::ScriptCompiler::CompileOptions compileOptions, We bTaskRunner* loadingTaskRunner)
98 { 98 {
99 return adoptRefWillBeNoop(new ScriptStreamer(script, scriptType, scriptS tate, compileOptions, loadingTaskRunner)); 99 return (new ScriptStreamer(script, scriptType, scriptState, compileOptio ns, loadingTaskRunner));
100 } 100 }
101 ScriptStreamer(PendingScript*, Type, ScriptState*, v8::ScriptCompiler::Compi leOptions, WebTaskRunner*); 101 ScriptStreamer(PendingScript*, Type, ScriptState*, v8::ScriptCompiler::Compi leOptions, WebTaskRunner*);
102 102
103 void streamingComplete(); 103 void streamingComplete();
104 void notifyFinishedToClient(); 104 void notifyFinishedToClient();
105 105
106 static bool startStreamingInternal(PendingScript*, Type, Settings*, ScriptSt ate*, WebTaskRunner*); 106 static bool startStreamingInternal(PendingScript*, Type, Settings*, ScriptSt ate*, WebTaskRunner*);
107 107
108 RawPtrWillBeMember<PendingScript> m_pendingScript; 108 Member<PendingScript> m_pendingScript;
109 // This pointer is weak. If PendingScript and its Resource are deleted 109 // This pointer is weak. If PendingScript and its Resource are deleted
110 // before ScriptStreamer, PendingScript will notify ScriptStreamer of its 110 // before ScriptStreamer, PendingScript will notify ScriptStreamer of its
111 // deletion by calling cancel(). 111 // deletion by calling cancel().
112 RawPtrWillBeMember<ScriptResource> m_resource; 112 Member<ScriptResource> m_resource;
113 // Whether ScriptStreamer is detached from the Resource. In those cases, the 113 // Whether ScriptStreamer is detached from the Resource. In those cases, the
114 // script data is not needed any more, and the client won't get notified 114 // script data is not needed any more, and the client won't get notified
115 // when the loading and streaming are done. 115 // when the loading and streaming are done.
116 bool m_detached; 116 bool m_detached;
117 117
118 SourceStream* m_stream; 118 SourceStream* m_stream;
119 OwnPtr<v8::ScriptCompiler::StreamedSource> m_source; 119 OwnPtr<v8::ScriptCompiler::StreamedSource> m_source;
120 bool m_loadingFinished; // Whether loading from the network is done. 120 bool m_loadingFinished; // Whether loading from the network is done.
121 // Whether the V8 side processing is done. Will be used by the main thread 121 // Whether the V8 side processing is done. Will be used by the main thread
122 // and the streamer thread; guarded by m_mutex. 122 // and the streamer thread; guarded by m_mutex.
(...skipping 17 matching lines...) Expand all
140 140
141 // Encoding of the streamed script. Saved for sanity checking purposes. 141 // Encoding of the streamed script. Saved for sanity checking purposes.
142 v8::ScriptCompiler::StreamedSource::Encoding m_encoding; 142 v8::ScriptCompiler::StreamedSource::Encoding m_encoding;
143 143
144 OwnPtr<WebTaskRunner> m_loadingTaskRunner; 144 OwnPtr<WebTaskRunner> m_loadingTaskRunner;
145 }; 145 };
146 146
147 } // namespace blink 147 } // namespace blink
148 148
149 #endif // ScriptStreamer_h 149 #endif // ScriptStreamer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698