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

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

Issue 829313004: Retire unnecessary ScriptStreamer back reference from SourceStream. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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 a2ff391dd1d99858ca1a3b39d21a34f1e783a399..7de78502e6e71385b30aba4c9807fe169c025b69 100644
--- a/Source/bindings/core/v8/ScriptStreamer.cpp
+++ b/Source/bindings/core/v8/ScriptStreamer.cpp
@@ -89,9 +89,8 @@ private:
class SourceStream : public v8::ScriptCompiler::ExternalSourceStream {
WTF_MAKE_NONCOPYABLE(SourceStream);
public:
- SourceStream(ScriptStreamer* streamer)
+ SourceStream()
: v8::ScriptCompiler::ExternalSourceStream()
- , m_streamer(streamer)
, m_cancelled(false)
, m_dataPosition(0) { }
@@ -124,10 +123,10 @@ public:
m_dataQueue.finish();
}
- void didReceiveData(size_t lengthOfBOM)
+ void didReceiveData(ScriptStreamer* streamer, size_t lengthOfBOM)
{
ASSERT(isMainThread());
- prepareDataOnMainThread(lengthOfBOM);
+ prepareDataOnMainThread(streamer, lengthOfBOM);
}
void cancel()
@@ -146,22 +145,22 @@ public:
}
private:
- void prepareDataOnMainThread(size_t lengthOfBOM)
+ void prepareDataOnMainThread(ScriptStreamer* streamer, size_t lengthOfBOM)
{
ASSERT(isMainThread());
// The Resource must still be alive; otherwise we should've cancelled
// the streaming (if we have cancelled, the background thread is not
// waiting).
- ASSERT(m_streamer->resource());
+ ASSERT(streamer->resource());
// BOM can only occur at the beginning of the data.
ASSERT(lengthOfBOM == 0 || m_dataPosition == 0);
- if (m_streamer->resource()->cachedMetadata(V8ScriptRunner::tagForCodeCache(m_streamer->resource()))) {
+ if (streamer->resource()->cachedMetadata(V8ScriptRunner::tagForCodeCache(streamer->resource()))) {
// The resource has a code cache, so it's unnecessary to stream and
// parse the code. Cancel the streaming and resume the non-streaming
// code path.
- m_streamer->suppressStreaming();
+ streamer->suppressStreaming();
{
MutexLocker locker(m_mutex);
m_cancelled = true;
@@ -172,7 +171,7 @@ private:
if (!m_resourceBuffer) {
// We don't have a buffer yet. Try to get it from the resource.
- SharedBuffer* buffer = m_streamer->resource()->resourceBuffer();
+ SharedBuffer* buffer = streamer->resource()->resourceBuffer();
m_resourceBuffer = RefPtr<SharedBuffer>(buffer);
}
@@ -206,8 +205,6 @@ private:
}
}
- ScriptStreamer* m_streamer;
-
// For coordinating between the main thread and background thread tasks.
// Guarded by m_mutex.
bool m_cancelled;
@@ -351,7 +348,7 @@ void ScriptStreamer::notifyAppendData(ScriptResource* resource)
ASSERT(!m_stream);
ASSERT(!m_source);
- m_stream = new SourceStream(this);
+ m_stream = new SourceStream();
// m_source takes ownership of m_stream.
m_source = adoptPtr(new v8::ScriptCompiler::StreamedSource(m_stream, m_encoding));
@@ -376,7 +373,7 @@ void ScriptStreamer::notifyAppendData(ScriptResource* resource)
blink::Platform::current()->histogramEnumeration(histogramName, 1, 2);
}
if (m_stream)
- m_stream->didReceiveData(lengthOfBOM);
+ m_stream->didReceiveData(this, lengthOfBOM);
}
void ScriptStreamer::notifyFinished(Resource* resource)
« 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