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

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

Issue 2249373002: Make Resource MemoryCoordinatorClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment Created 4 years, 3 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 "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"
11 #include "core/dom/PendingScript.h" 11 #include "core/dom/PendingScript.h"
12 #include "core/fetch/CachedMetadata.h"
12 #include "core/fetch/ScriptResource.h" 13 #include "core/fetch/ScriptResource.h"
13 #include "core/frame/Settings.h" 14 #include "core/frame/Settings.h"
14 #include "core/html/parser/TextResourceDecoder.h" 15 #include "core/html/parser/TextResourceDecoder.h"
15 #include "platform/CrossThreadFunctional.h" 16 #include "platform/CrossThreadFunctional.h"
16 #include "platform/Histogram.h" 17 #include "platform/Histogram.h"
17 #include "platform/SharedBuffer.h" 18 #include "platform/SharedBuffer.h"
18 #include "platform/TraceEvent.h" 19 #include "platform/TraceEvent.h"
19 #include "public/platform/WebScheduler.h" 20 #include "public/platform/WebScheduler.h"
20 #include "wtf/Deque.h" 21 #include "wtf/Deque.h"
21 #include "wtf/PtrUtil.h" 22 #include "wtf/PtrUtil.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 // BOM can only occur at the beginning of the data. 282 // BOM can only occur at the beginning of the data.
282 ASSERT(lengthOfBOM == 0 || m_queueTailPosition == 0); 283 ASSERT(lengthOfBOM == 0 || m_queueTailPosition == 0);
283 284
284 if (!streamer->resource()->response().cacheStorageCacheName().isNull()) { 285 if (!streamer->resource()->response().cacheStorageCacheName().isNull()) {
285 streamer->suppressStreaming(); 286 streamer->suppressStreaming();
286 cancel(); 287 cancel();
287 return; 288 return;
288 } 289 }
289 290
290 CachedMetadataHandler* cacheHandler = streamer->resource()->cacheHandler (); 291 CachedMetadataHandler* cacheHandler = streamer->resource()->cacheHandler ();
291 if (cacheHandler && cacheHandler->cachedMetadata(V8ScriptRunner::tagForC odeCache(cacheHandler))) { 292 RefPtr<CachedMetadata> codeCache(cacheHandler ? cacheHandler->cachedMeta data(V8ScriptRunner::tagForCodeCache(cacheHandler)) : nullptr);
293 if (codeCache.get()) {
hiroshige 2016/08/25 12:48:11 We can remove .get() here.
292 // The resource has a code cache, so it's unnecessary to stream and 294 // The resource has a code cache, so it's unnecessary to stream and
293 // parse the code. Cancel the streaming and resume the non-streaming 295 // parse the code. Cancel the streaming and resume the non-streaming
294 // code path. 296 // code path.
295 streamer->suppressStreaming(); 297 streamer->suppressStreaming();
296 cancel(); 298 cancel();
297 return; 299 return;
298 } 300 }
299 301
300 if (!m_resourceBuffer) { 302 if (!m_resourceBuffer) {
301 // We don't have a buffer yet. Try to get it from the resource. 303 // We don't have a buffer yet. Try to get it from the resource.
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 688
687 // 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
688 // needed. This makes PendingScript notify the ScriptStreamer when it is 690 // needed. This makes PendingScript notify the ScriptStreamer when it is
689 // destroyed. 691 // destroyed.
690 script->setStreamer(ScriptStreamer::create(script, scriptType, scriptState, compileOption, loadingTaskRunner)); 692 script->setStreamer(ScriptStreamer::create(script, scriptType, scriptState, compileOption, loadingTaskRunner));
691 693
692 return true; 694 return true;
693 } 695 }
694 696
695 } // namespace blink 697 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698