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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 365 |
366 // For coordinating between the main thread and background thread tasks. | 366 // For coordinating between the main thread and background thread tasks. |
367 // Guards m_cancelled and m_queueTailPosition. | 367 // Guards m_cancelled and m_queueTailPosition. |
368 Mutex m_mutex; | 368 Mutex m_mutex; |
369 | 369 |
370 // The shared buffer containing the resource data + state variables. | 370 // The shared buffer containing the resource data + state variables. |
371 // Used by both threads, guarded by m_mutex. | 371 // Used by both threads, guarded by m_mutex. |
372 bool m_cancelled; | 372 bool m_cancelled; |
373 bool m_finished; | 373 bool m_finished; |
374 | 374 |
375 RefPtr<SharedBuffer> m_resourceBuffer; // Only used by the main thread. | 375 RefPtr<const SharedBuffer> m_resourceBuffer; // Only used by the main thread
. |
376 | 376 |
377 // The queue contains the data to be passed to the V8 thread. | 377 // The queue contains the data to be passed to the V8 thread. |
378 // queueLeadPosition: data we have handed off to the V8 thread. | 378 // queueLeadPosition: data we have handed off to the V8 thread. |
379 // queueTailPosition: end of data we have enqued in the queue. | 379 // queueTailPosition: end of data we have enqued in the queue. |
380 // bookmarkPosition: position of the bookmark. | 380 // bookmarkPosition: position of the bookmark. |
381 SourceStreamDataQueue m_dataQueue; // Thread safe. | 381 SourceStreamDataQueue m_dataQueue; // Thread safe. |
382 size_t m_queueLeadPosition; // Only used by v8 thread. | 382 size_t m_queueLeadPosition; // Only used by v8 thread. |
383 size_t m_queueTailPosition; // Used by both threads; guarded by m_mutex. | 383 size_t m_queueTailPosition; // Used by both threads; guarded by m_mutex. |
384 size_t m_bookmarkPosition; // Only used by v8 thread. | 384 size_t m_bookmarkPosition; // Only used by v8 thread. |
385 | 385 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 | 688 |
689 // The Resource might go out of scope if the script is no longer | 689 // The Resource might go out of scope if the script is no longer |
690 // needed. This makes PendingScript notify the ScriptStreamer when it is | 690 // needed. This makes PendingScript notify the ScriptStreamer when it is |
691 // destroyed. | 691 // destroyed. |
692 script->setStreamer(ScriptStreamer::create(script, scriptType, scriptState,
compileOption, loadingTaskRunner)); | 692 script->setStreamer(ScriptStreamer::create(script, scriptType, scriptState,
compileOption, loadingTaskRunner)); |
693 | 693 |
694 return true; | 694 return true; |
695 } | 695 } |
696 | 696 |
697 } // namespace blink | 697 } // namespace blink |
OLD | NEW |