| 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 "config.h" | 5 #include "config.h" |
| 6 #include "bindings/core/v8/ScriptStreamer.h" | 6 #include "bindings/core/v8/ScriptStreamer.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptStreamerThread.h" | 8 #include "bindings/core/v8/ScriptStreamerThread.h" |
| 9 #include "bindings/core/v8/V8ScriptRunner.h" | 9 #include "bindings/core/v8/V8ScriptRunner.h" |
| 10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 *length = next_data.second; | 72 *length = next_data.second; |
| 73 return true; | 73 return true; |
| 74 } | 74 } |
| 75 if (m_finished) { | 75 if (m_finished) { |
| 76 *length = 0; | 76 *length = 0; |
| 77 return true; | 77 return true; |
| 78 } | 78 } |
| 79 return false; | 79 return false; |
| 80 } | 80 } |
| 81 | 81 |
| 82 WTF::Deque<std::pair<const uint8_t*, size_t> > m_data; | 82 WTF::Deque<std::pair<const uint8_t*, size_t>> m_data; |
| 83 bool m_finished; | 83 bool m_finished; |
| 84 Mutex m_mutex; | 84 Mutex m_mutex; |
| 85 ThreadCondition m_haveData; | 85 ThreadCondition m_haveData; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 | 88 |
| 89 // SourceStream implements the streaming interface towards V8. The main | 89 // SourceStream implements the streaming interface towards V8. The main |
| 90 // functionality is preparing the data to give to V8 on main thread, and | 90 // functionality is preparing the data to give to V8 on main thread, and |
| 91 // actually giving the data (via GetMoreData which is called on a background | 91 // actually giving the data (via GetMoreData which is called on a background |
| 92 // thread). | 92 // thread). |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 492 |
| 493 // The Resource might go out of scope if the script is no longer | 493 // The Resource might go out of scope if the script is no longer |
| 494 // needed. This makes PendingScript notify the ScriptStreamer when it is | 494 // needed. This makes PendingScript notify the ScriptStreamer when it is |
| 495 // destroyed. | 495 // destroyed. |
| 496 script.setStreamer(ScriptStreamer::create(resource, scriptState, compileOpti
on)); | 496 script.setStreamer(ScriptStreamer::create(resource, scriptState, compileOpti
on)); |
| 497 | 497 |
| 498 return true; | 498 return true; |
| 499 } | 499 } |
| 500 | 500 |
| 501 } // namespace blink | 501 } // namespace blink |
| OLD | NEW |