OLD | NEW |
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 #include "config.h" | 5 #include "config.h" |
6 #include "modules/serviceworkers/FetchBodyStream.h" | 6 #include "modules/serviceworkers/FetchBodyStream.h" |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
10 #include "bindings/core/v8/V8ThrowException.h" | 10 #include "bindings/core/v8/V8ThrowException.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 bool FetchBodyStream::hasPendingActivity() const | 107 bool FetchBodyStream::hasPendingActivity() const |
108 { | 108 { |
109 return m_resolver; | 109 return m_resolver; |
110 } | 110 } |
111 | 111 |
112 FetchBodyStream::FetchBodyStream(ExecutionContext* context, PassRefPtr<BlobDataH
andle> blobDataHandle) | 112 FetchBodyStream::FetchBodyStream(ExecutionContext* context, PassRefPtr<BlobDataH
andle> blobDataHandle) |
113 : ActiveDOMObject(context) | 113 : ActiveDOMObject(context) |
114 , m_blobDataHandle(blobDataHandle) | 114 , m_blobDataHandle(blobDataHandle) |
115 , m_hasRead(false) | 115 , m_hasRead(false) |
116 { | 116 { |
117 ScriptWrappable::init(this); | |
118 if (!m_blobDataHandle) { | 117 if (!m_blobDataHandle) { |
119 m_blobDataHandle = BlobDataHandle::create(BlobData::create(), 0); | 118 m_blobDataHandle = BlobDataHandle::create(BlobData::create(), 0); |
120 } | 119 } |
121 } | 120 } |
122 | 121 |
123 void FetchBodyStream::resolveJSON() | 122 void FetchBodyStream::resolveJSON() |
124 { | 123 { |
125 ASSERT(m_responseType == ResponseAsJSON); | 124 ASSERT(m_responseType == ResponseAsJSON); |
126 ScriptState::Scope scope(m_resolver->scriptState()); | 125 ScriptState::Scope scope(m_resolver->scriptState()); |
127 v8::Isolate* isolate = m_resolver->scriptState()->isolate(); | 126 v8::Isolate* isolate = m_resolver->scriptState()->isolate(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 { | 177 { |
179 ASSERT(m_resolver); | 178 ASSERT(m_resolver); |
180 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) | 179 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) |
181 return; | 180 return; |
182 | 181 |
183 m_resolver->resolve(""); | 182 m_resolver->resolve(""); |
184 m_resolver.clear(); | 183 m_resolver.clear(); |
185 } | 184 } |
186 | 185 |
187 } // namespace blink | 186 } // namespace blink |
OLD | NEW |