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

Unified Diff: Source/core/streams/ReadableStreamImpl.h

Issue 1233173002: Have ScriptPromiseResolver on the Oilpan heap always. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix webusb ScriptPromiseResolver usage Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/imagebitmap/ImageBitmapFactories.cpp ('k') | Source/core/streams/ReadableStreamReader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/streams/ReadableStreamImpl.h
diff --git a/Source/core/streams/ReadableStreamImpl.h b/Source/core/streams/ReadableStreamImpl.h
index 719fe8e040a940fe2c8cb9456434f1bfc9b3cee0..27ee8ce5de6082de5f5ac03a844e1ce77a46e360 100644
--- a/Source/core/streams/ReadableStreamImpl.h
+++ b/Source/core/streams/ReadableStreamImpl.h
@@ -118,18 +118,12 @@ public:
DEFINE_INLINE_VIRTUAL_TRACE()
{
visitor->trace(m_strategy);
-#if ENABLE(OILPAN)
visitor->trace(m_pendingReads);
-#endif
ReadableStream::trace(visitor);
}
private:
-#if ENABLE(OILPAN)
using PendingReads = HeapDeque<Member<ScriptPromiseResolver>>;
-#else
- using PendingReads = Deque<RefPtr<ScriptPromiseResolver>>;
-#endif
// ReadableStream methods
bool isQueueEmpty() const override { return m_queue.isEmpty(); }
@@ -142,8 +136,11 @@ private:
void resolveAllPendingReadsAsDone() override
{
for (auto& resolver : m_pendingReads) {
- ScriptState::Scope scope(resolver->scriptState());
- resolver->resolve(v8IteratorResultDone(resolver->scriptState()));
+ ScriptState* scriptState = resolver->scriptState();
+ if (!scriptState->contextIsValid())
+ continue;
+ ScriptState::Scope scope(scriptState);
+ resolver->resolve(v8IteratorResultDone(scriptState));
}
m_pendingReads.clear();
}
@@ -180,8 +177,10 @@ bool ReadableStreamImpl<ChunkTypeTraits>::enqueue(typename ChunkTypeTraits::Pass
return enqueuePostAction();
}
- RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = m_pendingReads.takeFirst();
+ ScriptPromiseResolver* resolver = m_pendingReads.takeFirst();
ScriptState* scriptState = resolver->scriptState();
+ if (!scriptState->contextIsValid())
+ return false;
ScriptState::Scope scope(scriptState);
resolver->resolve(v8IteratorResult(scriptState, chunk));
return enqueuePostAction();
« no previous file with comments | « Source/core/imagebitmap/ImageBitmapFactories.cpp ('k') | Source/core/streams/ReadableStreamReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698