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 "bindings/core/v8/ScriptStreamer.h" | 5 #include "bindings/core/v8/ScriptStreamer.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptStreamerThread.h" | 7 #include "bindings/core/v8/ScriptStreamerThread.h" |
8 #include "bindings/core/v8/V8ScriptRunner.h" | 8 #include "bindings/core/v8/V8ScriptRunner.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/dom/Element.h" | 10 #include "core/dom/Element.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // The resource has a code cache, so it's unnecessary to stream and | 290 // The resource has a code cache, so it's unnecessary to stream and |
291 // parse the code. Cancel the streaming and resume the non-streaming | 291 // parse the code. Cancel the streaming and resume the non-streaming |
292 // code path. | 292 // code path. |
293 streamer->suppressStreaming(); | 293 streamer->suppressStreaming(); |
294 cancel(); | 294 cancel(); |
295 return; | 295 return; |
296 } | 296 } |
297 | 297 |
298 if (!m_resourceBuffer) { | 298 if (!m_resourceBuffer) { |
299 // We don't have a buffer yet. Try to get it from the resource. | 299 // We don't have a buffer yet. Try to get it from the resource. |
300 SharedBuffer* buffer = streamer->resource()->resourceBuffer(); | 300 m_resourceBuffer = streamer->resource()->resourceBuffer(); |
301 m_resourceBuffer = RefPtr<SharedBuffer>(buffer); | |
302 } | 301 } |
303 | 302 |
304 fetchDataFromResourceBuffer(lengthOfBOM); | 303 fetchDataFromResourceBuffer(lengthOfBOM); |
305 } | 304 } |
306 | 305 |
307 void fetchDataFromResourceBuffer(size_t lengthOfBOM) | 306 void fetchDataFromResourceBuffer(size_t lengthOfBOM) |
308 { | 307 { |
309 ASSERT(isMainThread()); | 308 ASSERT(isMainThread()); |
310 MutexLocker locker(m_mutex); // For m_cancelled + m_queueTailPosition. | 309 MutexLocker locker(m_mutex); // For m_cancelled + m_queueTailPosition. |
311 | 310 |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 | 671 |
673 // The Resource might go out of scope if the script is no longer | 672 // The Resource might go out of scope if the script is no longer |
674 // needed. This makes PendingScript notify the ScriptStreamer when it is | 673 // needed. This makes PendingScript notify the ScriptStreamer when it is |
675 // destroyed. | 674 // destroyed. |
676 script->setStreamer(ScriptStreamer::create(script, scriptType, scriptState,
compileOption, loadingTaskRunner)); | 675 script->setStreamer(ScriptStreamer::create(script, scriptType, scriptState,
compileOption, loadingTaskRunner)); |
677 | 676 |
678 return true; | 677 return true; |
679 } | 678 } |
680 | 679 |
681 } // namespace blink | 680 } // namespace blink |
OLD | NEW |