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