Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1337)

Side by Side Diff: Source/bindings/core/v8/ScriptStreamer.cpp

Issue 929953002: CachedMetadata support for ServiceWorker script. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update WorkerScriptController.h Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 { 153 {
154 ASSERT(isMainThread()); 154 ASSERT(isMainThread());
155 // The Resource must still be alive; otherwise we should've cancelled 155 // The Resource must still be alive; otherwise we should've cancelled
156 // the streaming (if we have cancelled, the background thread is not 156 // the streaming (if we have cancelled, the background thread is not
157 // waiting). 157 // waiting).
158 ASSERT(streamer->resource()); 158 ASSERT(streamer->resource());
159 159
160 // BOM can only occur at the beginning of the data. 160 // BOM can only occur at the beginning of the data.
161 ASSERT(lengthOfBOM == 0 || m_dataPosition == 0); 161 ASSERT(lengthOfBOM == 0 || m_dataPosition == 0);
162 162
163 if (streamer->resource()->cachedMetadata(V8ScriptRunner::tagForCodeCache (streamer->resource()))) { 163 if (streamer->resource()->cacheHandler()->cachedMetadata(V8ScriptRunner: :tagForCodeCache(streamer->resource()))) {
164 // The resource has a code cache, so it's unnecessary to stream and 164 // The resource has a code cache, so it's unnecessary to stream and
165 // parse the code. Cancel the streaming and resume the non-streaming 165 // parse the code. Cancel the streaming and resume the non-streaming
166 // code path. 166 // code path.
167 streamer->suppressStreaming(); 167 streamer->suppressStreaming();
168 { 168 {
169 MutexLocker locker(m_mutex); 169 MutexLocker locker(m_mutex);
170 m_cancelled = true; 170 m_cancelled = true;
171 } 171 }
172 m_dataQueue.finish(); 172 m_dataQueue.finish();
173 return; 173 return;
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698