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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 MutexLocker locker(m_mutex); | 225 MutexLocker locker(m_mutex); |
226 m_queueLeadPosition = m_bookmarkPosition; | 226 m_queueLeadPosition = m_bookmarkPosition; |
227 // See comments at m_lengthOfBOM declaration below for why | 227 // See comments at m_lengthOfBOM declaration below for why |
228 // we need this here. | 228 // we need this here. |
229 m_queueTailPosition = m_bookmarkPosition + m_lengthOfBOM; | 229 m_queueTailPosition = m_bookmarkPosition + m_lengthOfBOM; |
230 m_dataQueue.clear(); | 230 m_dataQueue.clear(); |
231 } | 231 } |
232 | 232 |
233 // Inform main thread to re-queue the data. | 233 // Inform main thread to re-queue the data. |
234 m_loadingTaskRunner->postTask( | 234 m_loadingTaskRunner->postTask( |
235 BLINK_FROM_HERE, threadSafeBind(&SourceStream::fetchDataFromResource
Buffer, AllowCrossThreadAccess(this), 0)); | 235 BLINK_FROM_HERE, threadSafeBind(&SourceStream::fetchDataFromResource
Buffer, crossThreadUnretained(this), 0)); |
236 } | 236 } |
237 | 237 |
238 void didFinishLoading() | 238 void didFinishLoading() |
239 { | 239 { |
240 ASSERT(isMainThread()); | 240 ASSERT(isMainThread()); |
241 | 241 |
242 // ResetToBookmark may reset the data queue's 'finished' status, | 242 // ResetToBookmark may reset the data queue's 'finished' status, |
243 // so we may need to re-finish after a ResetToBookmark happened. | 243 // so we may need to re-finish after a ResetToBookmark happened. |
244 // We do this by remembering m_finished, and always checking for it | 244 // We do this by remembering m_finished, and always checking for it |
245 // at the end ot fetchDataFromResourceBuffer. | 245 // at the end ot fetchDataFromResourceBuffer. |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 | 674 |
675 // The Resource might go out of scope if the script is no longer | 675 // The Resource might go out of scope if the script is no longer |
676 // needed. This makes PendingScript notify the ScriptStreamer when it is | 676 // needed. This makes PendingScript notify the ScriptStreamer when it is |
677 // destroyed. | 677 // destroyed. |
678 script->setStreamer(ScriptStreamer::create(script, scriptType, scriptState,
compileOption, loadingTaskRunner)); | 678 script->setStreamer(ScriptStreamer::create(script, scriptType, scriptState,
compileOption, loadingTaskRunner)); |
679 | 679 |
680 return true; | 680 return true; |
681 } | 681 } |
682 | 682 |
683 } // namespace blink | 683 } // namespace blink |
OLD | NEW |