Chromium Code Reviews| Index: Source/bindings/core/v8/ScriptStreamer.h |
| diff --git a/Source/bindings/core/v8/ScriptStreamer.h b/Source/bindings/core/v8/ScriptStreamer.h |
| index b052376517a497e97303aaedcb7ade6da3e3fbd6..08d3644ae44058e64578658494a47247359188e9 100644 |
| --- a/Source/bindings/core/v8/ScriptStreamer.h |
| +++ b/Source/bindings/core/v8/ScriptStreamer.h |
| @@ -7,6 +7,7 @@ |
| #include "bindings/core/v8/ScriptStreamingMode.h" |
| #include "core/dom/PendingScript.h" |
| +#include "platform/heap/Handle.h" |
| #include "wtf/RefCounted.h" |
| #include <v8.h> |
| @@ -28,9 +29,17 @@ class SourceStream; |
| // streaming. It is possible, though, that Document and the PendingScript are |
| // destroyed while the streaming is in progress, and ScriptStreamer handles it |
| // gracefully. |
| -class ScriptStreamer : public RefCounted<ScriptStreamer> { |
| +class ScriptStreamer final : public RefCountedWillBeRefCountedGarbageCollected<ScriptStreamer> { |
| WTF_MAKE_NONCOPYABLE(ScriptStreamer); |
| public: |
| + static PassRefPtrWillBeRawPtr<ScriptStreamer> create(ScriptResource* resource, PendingScript::Type scriptType, ScriptStreamingMode mode, ScriptState* scriptState, v8::ScriptCompiler::CompileOptions compileOptions) |
| + { |
| + return adoptRefWillBeNoop(new ScriptStreamer(resource, scriptType, mode, scriptState, compileOptions)); |
| + } |
| + |
| + ~ScriptStreamer(); |
| + void trace(Visitor*); |
| + |
| // Launches a task (on a background thread) which will stream the given |
| // PendingScript into V8 as it loads. It's also possible that V8 cannot |
| // stream the given script; in that case this function returns |
| @@ -122,7 +131,7 @@ private: |
| // This pointer is weak. If PendingScript and its Resource are deleted |
| // before ScriptStreamer, PendingScript will notify ScriptStreamer of its |
| // deletion by calling cancel(). |
| - ScriptResource* m_resource; |
| + RawPtrWillBeMember<ScriptResource> m_resource; |
|
marja
2015/01/22 08:21:57
Why is the WillBeMember part correct? Will this re
haraken
2015/01/22 08:24:50
When an on-heap object X has a reference to anothe
|
| // Whether ScriptStreamer is detached from the Resource. In those cases, the |
| // script data is not needed any more, and the client won't get notified |
| // when the loading and streaming are done. |