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

Unified Diff: Source/bindings/core/v8/ScriptStreamer.cpp

Issue 1286883004: Keep lock during all of ScriptStreamer::fetchDataFromResourceBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/ScriptStreamer.cpp
diff --git a/Source/bindings/core/v8/ScriptStreamer.cpp b/Source/bindings/core/v8/ScriptStreamer.cpp
index 3f388af2a9f9d94b182a21ff8a418739380e32f6..72b7724bd882981cb3de96c2c370fa97b4eee53b 100644
--- a/Source/bindings/core/v8/ScriptStreamer.cpp
+++ b/Source/bindings/core/v8/ScriptStreamer.cpp
@@ -288,6 +288,7 @@ private:
void fetchDataFromResourceBuffer(size_t lengthOfBOM)
{
ASSERT(isMainThread());
+ MutexLocker locker(m_mutex); // For m_cancelled + m_queueTailPosition.
// Get as much data from the ResourceBuffer as we can.
const char* data = 0;
@@ -295,18 +296,15 @@ private:
Vector<unsigned> chunkLengths;
size_t dataLength = 0;
- {
- MutexLocker locker(m_mutex); // For m_cancelled + m_queueTailPosition.
- if (!m_cancelled) {
- while (unsigned length = m_resourceBuffer->getSomeData(data, m_queueTailPosition)) {
- // FIXME: Here we can limit based on the total length, if it turns
- // out that we don't want to give all the data we have (memory
- // vs. speed).
- chunks.append(data);
- chunkLengths.append(length);
- dataLength += length;
- m_queueTailPosition += length;
- }
+ if (!m_cancelled) {
+ while (unsigned length = m_resourceBuffer->getSomeData(data, m_queueTailPosition)) {
+ // FIXME: Here we can limit based on the total length, if it turns
+ // out that we don't want to give all the data we have (memory
+ // vs. speed).
+ chunks.append(data);
+ chunkLengths.append(length);
+ dataLength += length;
+ m_queueTailPosition += length;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698