| 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 ASSERT(isMainThread()); | 272 ASSERT(isMainThread()); |
| 273 | 273 |
| 274 // The Resource must still be alive; otherwise we should've cancelled | 274 // The Resource must still be alive; otherwise we should've cancelled |
| 275 // the streaming (if we have cancelled, the background thread is not | 275 // the streaming (if we have cancelled, the background thread is not |
| 276 // waiting). | 276 // waiting). |
| 277 ASSERT(streamer->resource()); | 277 ASSERT(streamer->resource()); |
| 278 | 278 |
| 279 // BOM can only occur at the beginning of the data. | 279 // BOM can only occur at the beginning of the data. |
| 280 ASSERT(lengthOfBOM == 0 || m_queueTailPosition == 0); | 280 ASSERT(lengthOfBOM == 0 || m_queueTailPosition == 0); |
| 281 | 281 |
| 282 if (!streamer->resource()->response().cacheStorageCacheName().isNull())
{ |
| 283 streamer->suppressStreaming(); |
| 284 cancel(); |
| 285 return; |
| 286 } |
| 287 |
| 282 CachedMetadataHandler* cacheHandler = streamer->resource()->cacheHandler
(); | 288 CachedMetadataHandler* cacheHandler = streamer->resource()->cacheHandler
(); |
| 283 if (cacheHandler && cacheHandler->cachedMetadata(V8ScriptRunner::tagForC
odeCache(cacheHandler))) { | 289 if (cacheHandler && cacheHandler->cachedMetadata(V8ScriptRunner::tagForC
odeCache(cacheHandler))) { |
| 284 // 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 |
| 285 // parse the code. Cancel the streaming and resume the non-streaming | 291 // parse the code. Cancel the streaming and resume the non-streaming |
| 286 // code path. | 292 // code path. |
| 287 streamer->suppressStreaming(); | 293 streamer->suppressStreaming(); |
| 288 cancel(); | 294 cancel(); |
| 289 return; | 295 return; |
| 290 } | 296 } |
| 291 | 297 |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 | 672 |
| 667 // The Resource might go out of scope if the script is no longer | 673 // The Resource might go out of scope if the script is no longer |
| 668 // needed. This makes PendingScript notify the ScriptStreamer when it is | 674 // needed. This makes PendingScript notify the ScriptStreamer when it is |
| 669 // destroyed. | 675 // destroyed. |
| 670 script->setStreamer(ScriptStreamer::create(script, scriptType, scriptState,
compileOption, loadingTaskRunner)); | 676 script->setStreamer(ScriptStreamer::create(script, scriptType, scriptState,
compileOption, loadingTaskRunner)); |
| 671 | 677 |
| 672 return true; | 678 return true; |
| 673 } | 679 } |
| 674 | 680 |
| 675 } // namespace blink | 681 } // namespace blink |
| OLD | NEW |