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

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

Issue 2539683002: Check if cancelled in prepareDataOnMainThread() (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 MutexLocker locker(m_mutex); 228 MutexLocker locker(m_mutex);
229 m_cancelled = true; 229 m_cancelled = true;
230 } 230 }
231 m_dataQueue.finish(); 231 m_dataQueue.finish();
232 } 232 }
233 233
234 private: 234 private:
235 void prepareDataOnMainThread(ScriptStreamer* streamer) { 235 void prepareDataOnMainThread(ScriptStreamer* streamer) {
236 DCHECK(isMainThread()); 236 DCHECK(isMainThread());
237 237
238 if (m_cancelled) {
239 m_dataQueue.finish();
240 return;
241 }
242
238 // The Resource must still be alive; otherwise we should've cancelled 243 // The Resource must still be alive; otherwise we should've cancelled
239 // the streaming (if we have cancelled, the background thread is not 244 // the streaming (if we have cancelled, the background thread is not
240 // waiting). 245 // waiting).
241 DCHECK(streamer->resource()); 246 DCHECK(streamer->resource());
242 247
243 if (!streamer->resource()->response().cacheStorageCacheName().isNull()) { 248 if (!streamer->resource()->response().cacheStorageCacheName().isNull()) {
244 streamer->suppressStreaming(); 249 streamer->suppressStreaming();
245 cancel(); 250 cancel();
246 return; 251 return;
247 } 252 }
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 // The Resource might go out of scope if the script is no longer 620 // The Resource might go out of scope if the script is no longer
616 // needed. This makes PendingScript notify the ScriptStreamer when it is 621 // needed. This makes PendingScript notify the ScriptStreamer when it is
617 // destroyed. 622 // destroyed.
618 script->setStreamer(ScriptStreamer::create(script, scriptType, scriptState, 623 script->setStreamer(ScriptStreamer::create(script, scriptType, scriptState,
619 compileOption, loadingTaskRunner)); 624 compileOption, loadingTaskRunner));
620 625
621 return true; 626 return true;
622 } 627 }
623 628
624 } // namespace blink 629 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698