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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 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 "bindings/core/v8/ScriptStreamer.h" 5 #include "bindings/core/v8/ScriptStreamer.h"
6 6
7 #include <memory> 7 #include <memory>
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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 DCHECK(streamer->resource()); 246 DCHECK(streamer->resource());
247 247
248 if (!streamer->resource()->response().cacheStorageCacheName().isNull()) { 248 if (!streamer->resource()->response().cacheStorageCacheName().isNull()) {
249 streamer->suppressStreaming(); 249 streamer->suppressStreaming();
250 cancel(); 250 cancel();
251 return; 251 return;
252 } 252 }
253 253
254 CachedMetadataHandler* cacheHandler = streamer->resource()->cacheHandler(); 254 CachedMetadataHandler* cacheHandler = streamer->resource()->cacheHandler();
255 RefPtr<CachedMetadata> codeCache( 255 RefPtr<CachedMetadata> codeCache(
256 cacheHandler 256 cacheHandler ? cacheHandler->cachedMetadata(
257 ? cacheHandler->cachedMetadata( 257 V8ScriptRunner::tagForCodeCache(cacheHandler))
258 V8ScriptRunner::tagForCodeCache(cacheHandler)) 258 : nullptr);
259 : nullptr);
260 if (codeCache.get()) { 259 if (codeCache.get()) {
261 // The resource has a code cache, so it's unnecessary to stream and 260 // The resource has a code cache, so it's unnecessary to stream and
262 // parse the code. Cancel the streaming and resume the non-streaming 261 // parse the code. Cancel the streaming and resume the non-streaming
263 // code path. 262 // code path.
264 streamer->suppressStreaming(); 263 streamer->suppressStreaming();
265 cancel(); 264 cancel();
266 return; 265 return;
267 } 266 }
268 267
269 if (!m_resourceBuffer) { 268 if (!m_resourceBuffer) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 void ScriptStreamer::streamingCompleteOnBackgroundThread() { 365 void ScriptStreamer::streamingCompleteOnBackgroundThread() {
367 DCHECK(!isMainThread()); 366 DCHECK(!isMainThread());
368 { 367 {
369 MutexLocker locker(m_mutex); 368 MutexLocker locker(m_mutex);
370 m_parsingFinished = true; 369 m_parsingFinished = true;
371 } 370 }
372 371
373 // notifyFinished might already be called, or it might be called in the 372 // notifyFinished might already be called, or it might be called in the
374 // future (if the parsing finishes earlier because of a parse error). 373 // future (if the parsing finishes earlier because of a parse error).
375 m_loadingTaskRunner->postTask( 374 m_loadingTaskRunner->postTask(
376 BLINK_FROM_HERE, crossThreadBind(&ScriptStreamer::streamingComplete, 375 BLINK_FROM_HERE,
377 wrapCrossThreadPersistent(this))); 376 crossThreadBind(&ScriptStreamer::streamingComplete,
377 wrapCrossThreadPersistent(this)));
378 378
379 // The task might delete ScriptStreamer, so it's not safe to do anything 379 // The task might delete ScriptStreamer, so it's not safe to do anything
380 // after posting it. Note that there's no way to guarantee that this 380 // after posting it. Note that there's no way to guarantee that this
381 // function has returned before the task is ran - however, we should not 381 // function has returned before the task is ran - however, we should not
382 // access the "this" object after posting the task. (Especially, we should 382 // access the "this" object after posting the task. (Especially, we should
383 // not be holding the mutex at this point.) 383 // not be holding the mutex at this point.)
384 } 384 }
385 385
386 void ScriptStreamer::cancel() { 386 void ScriptStreamer::cancel() {
387 DCHECK(isMainThread()); 387 DCHECK(isMainThread());
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 // needed. This makes PendingScript notify the ScriptStreamer when it is 623 // needed. This makes PendingScript notify the ScriptStreamer when it is
624 // destroyed. 624 // destroyed.
625 script->setStreamer(ScriptStreamer::create(script, scriptType, scriptState, 625 script->setStreamer(ScriptStreamer::create(script, scriptType, scriptState,
626 compileOption, 626 compileOption,
627 std::move(loadingTaskRunner))); 627 std::move(loadingTaskRunner)));
628 628
629 return true; 629 return true;
630 } 630 }
631 631
632 } // namespace blink 632 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptPromise.cpp ('k') | third_party/WebKit/Source/bindings/core/v8/ScriptValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698